diff --git a/CHANGELOG.md b/CHANGELOG.md index 71786f3..30aebc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # CHANGELOG - Fix #307: Fix French translation (arollmann) + - Fix #316: Fix New Response from Google OAuth Api ## 1.5.0 April 19, 2019 - Fix: Fix condition in EmailChangeService (it was always false) (borisaeric) diff --git a/src/User/AuthClient/Google.php b/src/User/AuthClient/Google.php index 4f04e01..a725978 100644 --- a/src/User/AuthClient/Google.php +++ b/src/User/AuthClient/Google.php @@ -21,9 +21,14 @@ class Google extends BaseGoogle implements AuthClientInterface */ public function getEmail() { - return isset($this->getUserAttributes()['emails'][0]['value']) - ? $this->getUserAttributes()['emails'][0]['value'] - : null; + $userAttributes = $this->getUserAttributes(); + if (isset($userAttributes['emails']) && isset($userAttributes['emails'][0]['value'])) { + return $userAttributes['emails'][0]['value']; + } elseif (isset($userAttributes['email'])) { + return $userAttributes['email']; + } + + return null; } /**