So, I managed to get the SimpleOAuthHandler working, setting up my redirect 
urls, etc:

    $scope = "https://www.googleapis.com/auth/adwords";;
    $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: 

  
  
https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=<client 
id>&redirect_uri=<my redirect 
url>&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fadwords&access_type=offline

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

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/1ccbd3c0-20ce-4cd9-9498-91febd58cd2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to