Class yii\authclient\clients\GoogleOAuth
| Inheritance | yii\authclient\clients\GoogleOAuth » yii\authclient\OAuth2 » yii\authclient\BaseOAuth » yii\authclient\BaseClient » yii\base\Component » yii\base\Object |
|---|---|
| Implements | yii\authclient\ClientInterface, yii\base\Configurable |
| Subclasses | yii\authclient\clients\GoogleHybrid |
| Available since version | 2.0 |
| Source Code | https://github.com/yiisoft/yii2-authclient/blob/master/clients/GoogleOAuth.php |
GoogleOAuth allows authentication via Google OAuth.
In order to use Google OAuth you must create a project at https://console.developers.google.com/project and setup its credentials at https://console.developers.google.com/project/[yourProjectId]/apiui/credential. In order to enable using scopes for retrieving user attributes, you should also enable Google+ API at https://console.developers.google.com/project/[yourProjectId]/apiui/api/plus
Example application configuration:
'components' => [
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'google' => [
'class' => 'yii\authclient\clients\GoogleOAuth',
'clientId' => 'google_client_id',
'clientSecret' => 'google_client_secret',
],
],
]
...
]
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
Method Details
Generates service name.
| string defaultName( ) | ||
| return | string | Service name. |
|---|---|---|
Generates service title.
| string defaultTitle( ) | ||
| return | string | Service title. |
|---|---|---|
Initializes the object.
This method is invoked at the end of the constructor after the object is initialized with the given configuration.
| void init( ) |
Initializes authenticated user attributes.
| array initUserAttributes( ) | ||
| return | array | Auth user attributes. |
|---|---|---|