Documentation

AdoptedBaseAuth extends BaseAuth
in package

Class provides integration with social networks authorization APIs.

Table of Contents

$settings  : array<string|int, mixed>
Authorization settings.
$userInfo  : array<string|int, mixed>
Fetched user's info.
__construct()  : mixed
Constructor.
auth()  : bool
Metthod tryes to authorize user.
dispatchUserInfo()  : array<string|int, mixed>
Method dispatches user info
getDesiredFields()  : string
Method returns a list of desired fields
getLink()  : string
Method returns authorization URL.
getOauthUri()  : string
Method returns URL wich generates tokens.
getTokenParams()  : array<string|int, mixed>
Method returns params for getting token
getTokenUri()  : string
Method returns token URL
getUserInfoUri()  : string
Method return URL wich provides user's info
requestToken()  : array<string|int, mixed>
Method requests token from server
getRequest()  : string
Method returns request result

Properties

$settings

Authorization settings.

public array<string|int, mixed> $settings = []

$userInfo

Fetched user's info.

public array<string|int, mixed> $userInfo

Methods

__construct()

Constructor.

public __construct(array<string|int, mixed> $settings) : mixed
Parameters
$settings : array<string|int, mixed>
  • Connection settings.
Return values
mixed

auth()

Metthod tryes to authorize user.

public auth(string $code) : bool
Parameters
$code : string
Return values
bool

True on success. False otherwise.

dispatchUserInfo()

Method dispatches user info

public dispatchUserInfo(array<string|int, mixed> $userInfo) : array<string|int, mixed>
Parameters
$userInfo : array<string|int, mixed>

User info got from social network

Return values
array<string|int, mixed>

Dispatched user info. Must be as array with keys id, first_name, last_name, email, picture

getDesiredFields()

Method returns a list of desired fields

public getDesiredFields() : string
Return values
string

Comma separated of the desired fields

Method returns authorization URL.

public getLink() : string
Return values
string

Authorization url.

getOauthUri()

Method returns URL wich generates tokens.

public getOauthUri() : string
Return values
string

URL

getTokenParams()

Method returns params for getting token

public getTokenParams(string $code) : array<string|int, mixed>
Parameters
$code : string

Access code

Return values
array<string|int, mixed>

Params

getTokenUri()

Method returns token URL

public getTokenUri() : string
Return values
string

URL

getUserInfoUri()

Method return URL wich provides user's info

public getUserInfoUri([string $token = '' ]) : string
Parameters
$token : string = ''

Token

Return values
string

URL

requestToken()

Method requests token from server

public requestToken(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Request params

Return values
array<string|int, mixed>

Token data

getRequest()

Method returns request result

protected getRequest(string $url) : string
Parameters
$url : string
Return values
string

Request result

Search results

    Яндекс.Метрика