Class yii\authclient\clients\VKontakte
| Inheritance | yii\authclient\clients\VKontakte » yii\authclient\OAuth2 » yii\authclient\BaseOAuth » yii\authclient\BaseClient » yii\base\Component » yii\base\Object |
|---|---|
| Implements | yii\authclient\ClientInterface, yii\base\Configurable |
| Available since version | 2.0 |
| Source Code | https://github.com/yiisoft/yii2-authclient/blob/master/clients/VKontakte.php |
VKontakte allows authentication via VKontakte OAuth.
In order to use VKontakte OAuth you must register your application at http://vk.com/editapp?act=create.
Example application configuration:
'components' => [
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'vkontakte' => [
'class' => 'yii\authclient\clients\VKontakte',
'clientId' => 'vkontakte_client_id',
'clientSecret' => 'vkontakte_client_secret',
],
],
]
...
]
See also:
Public Properties
Public Methods
Protected Methods
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| CONTENT_TYPE_AUTO | 'auto' | yii\authclient\BaseOAuth | |
| CONTENT_TYPE_JSON | 'json' | yii\authclient\BaseOAuth | |
| CONTENT_TYPE_URLENCODED | 'urlencoded' | yii\authclient\BaseOAuth | |
| CONTENT_TYPE_XML | 'xml' | yii\authclient\BaseOAuth |
Property Details
array $attributeNames = ['uid', 'first_name', 'last_name', 'nickname', 'screen_name', 'sex', 'bdate', 'city', 'country', 'timezone', 'photo']
List of attribute names, which should be requested from API to initialize user attributes.
Method Details
Performs request to the OAuth API.
| array apiInternal( $accessToken, $url, $method, array $params, array $headers ) | ||
| $accessToken | yii\authclient\OAuthToken | Actual access token. |
| $url | string | Absolute API URL. |
| $method | string | Request method. |
| $params | array | Request parameters. |
| $headers | array | Additional request headers. |
| return | array | API response. |
|---|---|---|
| throws | yii\base\Exception | on failure. |
Generates service name.
| string defaultName( ) | ||
| return | string | Service name. |
|---|---|---|
Returns the default $normalizeUserAttributeMap value.
Particular client may override this method in order to provide specific default map.
| array defaultNormalizeUserAttributeMap( ) | ||
| return | array | Normalize attribute map. |
|---|---|---|
Generates service title.
| string defaultTitle( ) | ||
| return | string | Service title. |
|---|---|---|
Initializes authenticated user attributes.
| array initUserAttributes( ) | ||
| return | array | Auth user attributes. |
|---|---|---|