diff --git a/extensions/yii/authclient/AuthAction.php b/extensions/yii/authclient/AuthAction.php index 9ccd848..d8af5e2 100644 --- a/extensions/yii/authclient/AuthAction.php +++ b/extensions/yii/authclient/AuthAction.php @@ -25,7 +25,7 @@ class AuthAction extends Action /** * @var string name of the auth client collection application component. */ - public $clientCollection; + public $clientCollection = 'auth'; /** * @var string name of the GET param, which is used to passed auth client id to this action. */ @@ -227,7 +227,7 @@ class AuthAction extends Action break; } } else { - $provider->identity = $provider->authUrl; // Setting identifier + //$provider->identity = $provider->authUrl; // Setting identifier $request = Yii::$app->getRequest(); $provider->realm = $request->getHostInfo(); $provider->returnUrl = $provider->realm . $request->getUrl(); // getting return URL diff --git a/extensions/yii/authclient/OpenId.php b/extensions/yii/authclient/OpenId.php index b614578..46b2d9a 100644 --- a/extensions/yii/authclient/OpenId.php +++ b/extensions/yii/authclient/OpenId.php @@ -540,7 +540,7 @@ class OpenId extends Component implements ClientInterface $counts = []; $required = []; $optional = []; - foreach (['required', 'optional'] as $type) { + foreach (['requiredAttributes', 'optional'] as $type) { foreach ($this->$type as $alias => $field) { if (is_int($alias)) { $alias = strtr($field, '/', '_'); @@ -626,7 +626,6 @@ class OpenId extends Component implements ClientInterface $params['openid.identity'] = $this->identity; $params['openid.claimed_id'] = $this->claimed_id; } - return $this->buildUrl(parse_url($this->server), ['query' => http_build_query($params, '', '&')]); } @@ -747,7 +746,7 @@ class OpenId extends Component implements ClientInterface protected function getSregAttributes() { - $attributes = array(); + $attributes = []; $sregToAx = array_flip(self::$axToSregMap); foreach ($this->data as $key => $value) { $keyMatch = 'openid_sreg_'; diff --git a/extensions/yii/authclient/clients/GoogleOpenId.php b/extensions/yii/authclient/clients/GoogleOpenId.php index 7eca6d7..420f827 100644 --- a/extensions/yii/authclient/clients/GoogleOpenId.php +++ b/extensions/yii/authclient/clients/GoogleOpenId.php @@ -17,5 +17,15 @@ use yii\authclient\OpenId; */ class GoogleOpenId extends OpenId { - + public function init() + { + parent::init(); + $this->setIdentity('https://www.google.com/accounts/o8/id'); + $this->requiredAttributes = [ + 'namePerson/first', + 'namePerson/last', + 'contact/email', + 'pref/language', + ]; + } } \ No newline at end of file