Ok, thanks Josh, that did it. I pushed forward with running my report, and 
now I get a "DEVELOPER_TOKEN_NOT_APPROVED" error, so I guess I need to wait 
for that to happen.



On Thursday, July 16, 2015 at 5:56:41 AM UTC-7, cisc...@gmail.com wrote:
>
> 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/633ca3bc-4c1d-4628-bf9f-e9b130dba14b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to