Merge branch 'develop' of github.com:invoiceninja/invoiceninja into develop
This commit is contained in:
commit
07296fae9b
2 changed files with 7 additions and 3 deletions
|
|
@ -30,7 +30,7 @@ class OAuth {
|
|||
$user = null;
|
||||
|
||||
if($this->providerInstance)
|
||||
$user = User::where('email', $this->providerInstance->getTokenResponse($token))->first();
|
||||
$user = User::where('oauth_user_id', $this->providerInstance->getTokenResponse($token))->first();
|
||||
|
||||
if ($user)
|
||||
return $user;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class Google implements ProviderInterface
|
|||
$client = new \Google_Client(['client_id' => env('GOOGLE_CLIENT_ID','')]);
|
||||
$payload = $client->verifyIdToken($token);
|
||||
if ($payload)
|
||||
return $this->harvestEmail($payload);
|
||||
return $this->harvestSubField($payload);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
|
@ -19,5 +19,9 @@ class Google implements ProviderInterface
|
|||
return $payload['email'];
|
||||
}
|
||||
|
||||
|
||||
private function harvestSubField($payload)
|
||||
{
|
||||
$data = $payload->getAttributes();
|
||||
return $data['payload']['sub']; // user ID
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue