mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Merge branch 'develop' of github.com:invoiceninja/invoiceninja into develop
This commit is contained in:
commit
07296fae9b
@ -30,7 +30,7 @@ class OAuth {
|
|||||||
$user = null;
|
$user = null;
|
||||||
|
|
||||||
if($this->providerInstance)
|
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)
|
if ($user)
|
||||||
return $user;
|
return $user;
|
||||||
|
@ -9,7 +9,7 @@ class Google implements ProviderInterface
|
|||||||
$client = new \Google_Client(['client_id' => env('GOOGLE_CLIENT_ID','')]);
|
$client = new \Google_Client(['client_id' => env('GOOGLE_CLIENT_ID','')]);
|
||||||
$payload = $client->verifyIdToken($token);
|
$payload = $client->verifyIdToken($token);
|
||||||
if ($payload)
|
if ($payload)
|
||||||
return $this->harvestEmail($payload);
|
return $this->harvestSubField($payload);
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -19,5 +19,9 @@ class Google implements ProviderInterface
|
|||||||
return $payload['email'];
|
return $payload['email'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function harvestSubField($payload)
|
||||||
|
{
|
||||||
|
$data = $payload->getAttributes();
|
||||||
|
return $data['payload']['sub']; // user ID
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user