18 require
'vendor/autoload.php';
32 $clientId =
'RANDOMCHARS-----duv1n2.apps.googleusercontent.com';
61 return 'https://accounts.google.com/o/oauth2/auth';
66 return 'https://accounts.google.com/o/oauth2/token';
76 if (is_array($this->scope)) {
78 $this->scope = implode($separator, $this->scope);
82 parent::getAuthorizationParameters($options),
84 'hd' => $this->hostedDomain,
85 'access_type' => $this->accessType,
86 'scope' => $this->scope,
110 if (!empty(
$data[
'error'])) {
125 return new GoogleUser($response);
136 'scope' =>
array(
'https://mail.google.com/'),
137 'accessType' =>
'offline' 141 if (!isset(
$_GET[
'code'])) {
143 $authUrl =
$provider->getAuthorizationUrl();
145 header(
'Location: ' . $authUrl);
150 exit(
'Invalid state');
154 'authorization_code',
156 'code' =>
$_GET[
'code']
161 echo
'Refresh Token: ' . $token->getRefreshToken();
getBaseAccessTokenUrl(array $params)
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
getBaseAuthorizationUrl()
createResourceOwner(array $response, AccessToken $token)
getResourceOwnerDetailsUrl(AccessToken $token)
const ACCESS_TOKEN_RESOURCE_OWNER_ID
checkResponse(ResponseInterface $response, $data)
Representation of an outgoing, server-side response.
Add a drawing to the header
getAuthorizationParameters(array $options)
Create styles array
The data for the language used.
Get an OAuth2 token from Google.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options