Class yii\authclient\clients\GoogleHybrid
Inheritance | yii\authclient\clients\GoogleHybrid » 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 |
Available since version | 2.0.4 |
Source Code | https://github.com/yiisoft/yii2-authclient/blob/master/clients/GoogleHybrid.php |
GoogleHybrid is an enhanced version of the yii\authclient\clients\Google, which uses Google+ hybrid sign-in flow, which relies on embedded JavaScript code to generate a sign-in button and handle user authentication dialog.
Example application configuration:
'components' => [
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'google' => [
'class' => 'yii\authclient\clients\GoogleHybrid',
'clientId' => 'google_client_id',
'clientSecret' => 'google_client_secret',
],
],
]
// ...
]
Note: Google+ hybrid relies heavily on client-side JavaScript during authorization process, do not attempt to obtain authorization code using buildAuthUrl() unless you absolutely sure, what you are doing.
JavaScript button itself generated by yii\authclient\widgets\GooglePlusButton widget. If you are using 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:
Public Properties
Public Methods
Protected Methods
Property Details
Whether to use and validate auth 'state' parameter in authentication flow. If enabled - the opaque value will be generated and applied to auth URL to maintain state between the request and callback. The authorization server includes this value, when redirecting the user-agent back to the client. The option is used for preventing cross-site request forgery.
Method Details
Composes default $returnUrl value.
protected 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.
protected array defaultViewOptions ( ) | ||
return | array | List of default $viewOptions |
---|