So, I managed to get the SimpleOAuthHandler working, setting up my redirect urls, etc:
$server = NULL;
$handler = new SimpleOAuth2Handler($server, $scope);
$googleOAuthCredentials = new GoogleOAuthCredentials();
$credentials = array( 'client_id' => <my client_id>
'client_secret' => <my client secret> ,
);
$redirectURL = <my redirect url>
// true means i want an offline token, i.e., give me a refresh token
$google_url = $handler->GetAuthorizationUrl($credentials, $redirectURL, true);
The generated URL is:
Which takes me to the Google login screen. When I select the appropriate account, it comes back to my redirectURL
with a code, which I use to get an access token:
$token_info = $handler->GetAccessToken($credentials, $code, $redirectURL);
But the token_info I get back doesn't include a refresh token:
Array
(
[client_id] => <my client_id>
[client_secret] => <my client secret>
[access_token] => <my new access token>
[token_type] => Bearer
[expires_in] => 3599
[timestamp] => 1437002357
)
Why wouldn't access_type=offline cause a refresh token to be returned?
thanks,
Andy