Class yii\authclient\clients\GoogleHybrid
Inheritance | yii\authclient\clients\GoogleHybrid » 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 |
Available since version | 2.0 |
Source Code | https://github.com/yiisoft/yii2-authclient/blob/master/clients/GoogleHybrid.php |
GoogleHybrid is an enhanced version of the yii\authclient\clients\GoogleOAuth, which uses Google+ hybrid sign-in flow, which relies on embedded JavaScript code to generate a sign-in button.
Example application configuration:
'components' => [
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'google' => [
'class' => 'yii\authclient\clients\GoogleHybrid',
'clientId' => 'google_client_id',
'clientSecret' => 'google_client_secret',
],
],
]
...
]
JavaScript button itself generated by \yii\authclient\clients\yii\authclient\widgets\GooglePlusButton widget. If you are using \yii\authclient\clients\yii\authclient\widgets\AuthChoice it will appear automatically. Otherwise you need to add it into your page manually. You may customize its appearance using 'widget' key at $viewOptions:
'google' => [
...
'viewOptions' => [
'widget' => [
'class' => 'yii\authclient\widgets\GooglePlusButton',
'buttonHtmlOptions' => [
'data-approvalprompt' => 'force'
],
],
],
],
See also:
- yii\authclient\clients\GoogleOAuth
- \yii\authclient\clients\yii\authclient\widgets\GooglePlusButton
- https://developers.google.com/ /web/signin
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 |
Method Details
Composes default $returnUrl value.
string defaultReturnUrl( ) | ||
return | string | Return URL. |
---|
Returns the default $viewOptions value.
Particular client may override this method in order to provide specific default view options.
array defaultViewOptions( ) | ||
return | array | List of default $viewOptions |
---|