On this page
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\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\Google, 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\Google
- yii\authclient\widgets\GooglePlusButton
- https://developers.google.com/ /web/signin
Public Properties
Public Methods
Protected Methods
Property Details
$validateAuthState public property
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.
public boolean $validateAuthState = false
Method Details
defaultReturnUrl() protected method
Composes default $returnUrl value.
protected string defaultReturnUrl ( ) | ||
---|---|---|
return | string | Return URL. |
defaultViewOptions() protected method
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 |
© 2008–2017 by Yii Software LLC
Licensed under the three clause BSD license.
http://www.yiiframework.com/doc-2.0/yii-authclient-clients-googlehybrid.html