Commit 39436410 by Klimov Paul

User attributes requesting at GoogleOAuth switched to Google+ API

parent 98d3a8c0
...@@ -6,6 +6,7 @@ Yii Framework 2 authclient extension Change Log ...@@ -6,6 +6,7 @@ Yii Framework 2 authclient extension Change Log
- Bug #3633: OpenId return URL comparison advanced to prevent url encode problem (klimov-paul) - Bug #3633: OpenId return URL comparison advanced to prevent url encode problem (klimov-paul)
- Enh #3416: VKontakte OAuth support added (klimov-paul) - Enh #3416: VKontakte OAuth support added (klimov-paul)
- Enh #4139: User attributes requesting at GoogleOAuth switched to Google+ API (klimov-paul)
2.0.0-beta April 13, 2014 2.0.0-beta April 13, 2014
......
...@@ -12,7 +12,10 @@ use yii\authclient\OAuth2; ...@@ -12,7 +12,10 @@ use yii\authclient\OAuth2;
/** /**
* GoogleOAuth allows authentication via Google OAuth. * GoogleOAuth allows authentication via Google OAuth.
* *
* In order to use Google OAuth you must register your application at <https://code.google.com/apis/console#access>. * In order to use Google OAuth you must create a project at <https://console.developers.google.com/project>
* and setup its credentials at <https://console.developers.google.com/project/[yourProjectId]/apiui/credential>.
* In order to enable using scopes for retrieving user attributes, you should also enable Google+ API at
* <https://console.developers.google.com/project/[yourProjectId]/apiui/api/plus>
* *
* Example application configuration: * Example application configuration:
* *
...@@ -32,8 +35,7 @@ use yii\authclient\OAuth2; ...@@ -32,8 +35,7 @@ use yii\authclient\OAuth2;
* ] * ]
* ~~~ * ~~~
* *
* @see https://code.google.com/apis/console#access * @see https://console.developers.google.com/project
* @see https://developers.google.com/google-apps/contacts/v3/
* *
* @author Paul Klimov <klimov.paul@gmail.com> * @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.0 * @since 2.0
...@@ -51,7 +53,7 @@ class GoogleOAuth extends OAuth2 ...@@ -51,7 +53,7 @@ class GoogleOAuth extends OAuth2
/** /**
* @inheritdoc * @inheritdoc
*/ */
public $apiBaseUrl = 'https://www.googleapis.com/oauth2/v1'; public $apiBaseUrl = 'https://www.googleapis.com/plus/v1';
/** /**
* @inheritdoc * @inheritdoc
...@@ -61,8 +63,8 @@ class GoogleOAuth extends OAuth2 ...@@ -61,8 +63,8 @@ class GoogleOAuth extends OAuth2
parent::init(); parent::init();
if ($this->scope === null) { if ($this->scope === null) {
$this->scope = implode(' ', [ $this->scope = implode(' ', [
'https://www.googleapis.com/auth/userinfo.profile', 'profile',
'https://www.googleapis.com/auth/userinfo.email', 'email',
]); ]);
} }
} }
...@@ -72,7 +74,7 @@ class GoogleOAuth extends OAuth2 ...@@ -72,7 +74,7 @@ class GoogleOAuth extends OAuth2
*/ */
protected function initUserAttributes() protected function initUserAttributes()
{ {
return $this->api('userinfo', 'GET'); return $this->api('people/me', 'GET');
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment