From 4d24de35e531513bb23a08dcc5e9ddeea867b892 Mon Sep 17 00:00:00 2001 From: Dharma Saputra Date: Fri, 21 Dec 2018 15:29:27 +0700 Subject: [PATCH 1/2] [UPDATE] Change google plus api --- src/Two/GoogleProvider.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Two/GoogleProvider.php b/src/Two/GoogleProvider.php index 9cb9a5e2..53ce1b91 100644 --- a/src/Two/GoogleProvider.php +++ b/src/Two/GoogleProvider.php @@ -58,7 +58,7 @@ protected function getTokenFields($code) */ protected function getUserByToken($token) { - $response = $this->getHttpClient()->get('https://www.googleapis.com/plus/v1/people/me?', [ + $response = $this->getHttpClient()->get('https://www.googleapis.com/userinfo/v2/me?', [ 'query' => [ 'prettyPrint' => 'false', ], @@ -76,11 +76,14 @@ protected function getUserByToken($token) */ protected function mapUserToObject(array $user) { - $avatarUrl = Arr::get($user, 'image.url'); + $avatarUrl = Arr::get($user, 'picture'); return (new User)->setRaw($user)->map([ - 'id' => $user['id'], 'nickname' => Arr::get($user, 'nickname'), 'name' => $user['displayName'], - 'email' => Arr::get($user, 'emails.0.value'), 'avatar' => $avatarUrl, + 'id' => $user['id'], + 'nickname' => Arr::get($user, 'nickname'), + 'name' => Arr::get($user, 'name'), + 'email' => Arr::get($user, 'email'), + 'avatar' => $avatarUrl, 'avatar_original' => preg_replace('/\?sz=([0-9]+)/', '', $avatarUrl), ]); } From b381b55df5e8864b27ce5f2b621d178f68b9599d Mon Sep 17 00:00:00 2001 From: Dharma Saputra Date: Fri, 21 Dec 2018 15:47:34 +0700 Subject: [PATCH 2/2] fix styleCI --- src/Two/GoogleProvider.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Two/GoogleProvider.php b/src/Two/GoogleProvider.php index d8a6c7f7..fc08a998 100644 --- a/src/Two/GoogleProvider.php +++ b/src/Two/GoogleProvider.php @@ -79,10 +79,10 @@ protected function mapUserToObject(array $user) $avatarUrl = Arr::get($user, 'picture'); return (new User)->setRaw($user)->map([ - 'id' => $user['id'], - 'nickname' => Arr::get($user, 'nickname'), + 'id' => $user['id'], + 'nickname' => Arr::get($user, 'nickname'), 'name' => Arr::get($user, 'name'), - 'email' => Arr::get($user, 'email'), + 'email' => Arr::get($user, 'email'), 'avatar' => $avatarUrl, 'avatar_original' => preg_replace('/\?sz=([0-9]+)/', '', $avatarUrl), ]);