2020-04-15 02:30:52 +02:00
|
|
|
<?php
|
2020-04-06 14:32:27 +02:00
|
|
|
|
|
|
|
namespace App\Libraries\OAuth\Providers;
|
2019-05-22 05:18:18 +02:00
|
|
|
|
|
|
|
class Google implements ProviderInterface
|
|
|
|
{
|
|
|
|
public function getTokenResponse($token)
|
|
|
|
{
|
|
|
|
$client = new \Google_Client();
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2019-05-22 05:18:18 +02:00
|
|
|
return $client->verifyIdToken($token);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function harvestEmail($payload)
|
|
|
|
{
|
|
|
|
return $payload['email'];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function harvestSubField($payload)
|
|
|
|
{
|
|
|
|
return $payload['sub']; // user ID
|
|
|
|
}
|
2020-05-13 06:51:16 +02:00
|
|
|
|
2020-05-13 08:20:05 +02:00
|
|
|
public function harvestName($payload)
|
2020-05-13 06:51:16 +02:00
|
|
|
{
|
|
|
|
return $payload['name'];
|
|
|
|
}
|
2019-05-22 05:18:18 +02:00
|
|
|
}
|