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 |
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\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'
],
],
],
],
请参阅:
Public Properties
隐藏继承的属性 Hide inherited properties
Public Methods
隐藏继承的方法 Hide inherited methods
Protected Methods
隐藏继承的方法 Hide inherited 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 |
---|