Documentation

Odnoklassniki extends BaseAuth
in package

Class provides integration with OK

Tags
author

Dodonov A.A.

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
getSettings()  : array<string|int, mixed>
Method returns settings
getTokenParams()  : array<string|int, mixed>
Method returns params for getting token
getTokenUri()  : string
Method returns
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.

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

$userInfo

Fetched user's info.

protected 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

getSettings()

Method returns settings

public getSettings() : array<string|int, mixed>
Return values
array<string|int, mixed>

settigs

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

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

Tags
see
BaseAuth::getUserInfoUri()
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
Tags
codeCoverageIgnore
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