Class yii\authclient\clients\Google
Inheritance | yii\authclient\clients\Google » yii\authclient\OAuth2 » yii\authclient\BaseOAuth » yii\authclient\BaseClient » yii\base\Component » yii\base\BaseObject |
---|---|
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/Google.php |
Google 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/apis/credentials?project=[yourProjectId].
Example application configuration:
'components' => [
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'google' => [
'class' => 'yii\authclient\clients\Google',
'clientId' => 'google_client_id',
'clientSecret' => 'google_client_secret',
],
],
]
// ...
]
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$apiBaseUrl | {@inheritdoc} | yii\authclient\clients\Google | |
$authUrl | {@inheritdoc} | yii\authclient\clients\Google | |
$autoRefreshAccessToken | boolean | Whether to automatically perform 'refresh access token' request on expired access token. | yii\authclient\BaseOAuth |
$clientId | string | OAuth client ID. | yii\authclient\OAuth2 |
$clientSecret | string | OAuth client secret. | yii\authclient\OAuth2 |
$parametersToKeepInReturnUrl | array | List of the parameters to keep in default return url. | yii\authclient\BaseOAuth |
$scope | string | Auth request scope. | yii\authclient\BaseOAuth |
$tokenUrl | {@inheritdoc} | yii\authclient\clients\Google | |
$validateAuthState | boolean | Whether to use and validate auth 'state' parameter in authentication flow. | yii\authclient\OAuth2 |
$version | string | Protocol version. | yii\authclient\BaseOAuth |
Public Methods
Protected Methods
Method | Description | Defined By |
---|---|---|
applyClientCredentialsToRequest() | Applies client credentials (e.g. $clientId and $clientSecret) to the HTTP request instance. | yii\authclient\OAuth2 |
composeUrl() | Composes URL from base URL and GET params. | yii\authclient\BaseOAuth |
createHttpClient() | Creates HTTP client instance from reference or configuration. | yii\authclient\BaseClient |
createSignatureMethod() | Creates signature method instance from its configuration. | yii\authclient\BaseOAuth |
createToken() | Creates token from its configuration. | yii\authclient\BaseOAuth |
defaultName() | {@inheritdoc} | yii\authclient\clients\Google |
defaultNormalizeUserAttributeMap() | Returns the default \yii\authclient\normalizeUserAttributeMap value. | yii\authclient\BaseClient |
defaultRequestOptions() | Returns default HTTP request options. | yii\authclient\BaseClient |
defaultReturnUrl() | Composes default \yii\authclient\returnUrl value. | yii\authclient\BaseOAuth |
defaultTitle() | {@inheritdoc} | yii\authclient\clients\Google |
defaultViewOptions() | Returns the default \yii\authclient\viewOptions value. | yii\authclient\BaseClient |
generateAuthState() | Generates the auth state value. | yii\authclient\OAuth2 |
getState() | Returns persistent state value. | yii\authclient\BaseClient |
getStateKeyPrefix() | Returns session key prefix, which is used to store internal states. | yii\authclient\BaseClient |
initUserAttributes() | {@inheritdoc} | yii\authclient\clients\Google |
normalizeUserAttributes() | Normalize given user attributes according to \yii\authclient\normalizeUserAttributeMap. | yii\authclient\BaseClient |
removeState() | Removes persistent state value. | yii\authclient\BaseClient |
restoreAccessToken() | Restores access token. | yii\authclient\BaseOAuth |
saveAccessToken() | Saves token as persistent state. | yii\authclient\BaseOAuth |
sendRequest() | Sends the given HTTP request, returning response data. | yii\authclient\BaseOAuth |
setState() | Sets persistent state. | yii\authclient\BaseClient |
Property Details
Method Details
{@inheritdoc}
protected void defaultName ( ) |
{@inheritdoc}
protected void defaultTitle ( ) |
{@inheritdoc}
public void init ( ) |
{@inheritdoc}
protected void initUserAttributes ( ) |