2017-03-30 15:01:42 +02:00
|
|
|
<?php namespace App\Ninja\OAuth\Providers;
|
|
|
|
|
|
|
|
class Google implements ProviderInterface
|
|
|
|
{
|
|
|
|
|
|
|
|
public function getTokenResponse($token)
|
|
|
|
{
|
|
|
|
|
|
|
|
$client = new \Google_Client(['client_id' => env('GOOGLE_CLIENT_ID','')]);
|
2017-08-08 07:26:19 +02:00
|
|
|
return $client->verifyIdToken($token);
|
2017-03-30 15:01:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function harvestEmail($payload)
|
|
|
|
{
|
|
|
|
return $payload['email'];
|
|
|
|
}
|
|
|
|
|
2017-08-08 07:26:19 +02:00
|
|
|
public function harvestSubField($payload)
|
2017-08-08 04:55:50 +02:00
|
|
|
{
|
2017-08-08 12:36:28 +02:00
|
|
|
return $payload['sub']; // user ID
|
2017-08-08 04:55:50 +02:00
|
|
|
}
|
2017-03-30 15:01:42 +02:00
|
|
|
}
|