\SocialNetworkAuth

Class provides integration with social networks authorization APIs.

Summary

Methods
Properties
Constants
__construct()
auth()
get_link()
get_oauth_uri()
get_user_info_uri()
get_token_uri()
get_desired_fields()
dispatch_user_info()
get_token_params()
request_token()
$Setttings
$UserInfo
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$Setttings

$Setttings : array

Authorization settings.

Type

array

$UserInfo

$UserInfo : array

Fetched user's info.

Type

array

Methods

__construct()

__construct(array  $Settings) 

Constructor.

Parameters

array $Settings
  • Connection settings.

auth()

auth(string  $Code) : boolean

Metthod tryes to authorize user.

Parameters

string $Code
  • Code.

Returns

boolean —

True on success. False otherwise.

get_link()

get_link() : string

Method returns authorization URL.

Returns

string —

Authorization url.

get_oauth_uri()

get_oauth_uri() : string

Method returns URL wich generates tokens.

Returns

string —

URL

get_user_info_uri()

get_user_info_uri(string  $Token = '') : string

Method return URL wich provides user's info.

Parameters

string $Token
  • Token;

Returns

string —

URL

get_token_uri()

get_token_uri() : string

Method returns token URL.

Returns

string —

URL

get_desired_fields()

get_desired_fields() : string

Method returns a list of desired fields.

Returns

string —

Comma separated of the desired fields.

dispatch_user_info()

dispatch_user_info(array  $UserInfo) : array

Method dispatches user info.

Parameters

array $UserInfo
  • User info got from social network.

Returns

array —

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

get_token_params()

get_token_params(string  $Code) : array

Method returns params for getting token.

Parameters

string $Code
  • Access code.

Returns

array —

Params

request_token()

request_token(array  $Params) : array

Method requests token from server.

Parameters

array $Params
  • Request params.

Returns

array —

Token data.