Hi Mike,

This is, admittedly, a bit of a wild guess, but I noticed that when I went 
through the refresh token example my auth URL did *not* include a *state* 
parameter. 
Maybe give it a shot with that parameter removed?

Cheers,
Josh, AdWords API Team

On Thursday, June 5, 2014 4:53:13 PM UTC-4, Mike Swan wrote:
>
> Hi All,
>
> I have scoured the group and the Internet (SO, etc.) and I can't find any 
> direction.  For some reason a refresh token is not being returned through 
> the API along with the access token.  
>
> My auth URL looks like this:
>
> https://accounts.google.com/o/oauth2/auth?state=10&response_type=code&client_id=xxxx.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Fdomain.com%2Fapi%2Foauth2return-Adwords.php&scope=https%3A%2F%2Fadwords.google.com%2Fapi%2Fadwords%2F&access_type=offline
>
> It returns this:
>
> http://domain.com/api/oauth2return-Adwords.php?state=10&code=xxx
>
> Which gets put through this script:
>
> $callbackUrl = "http://domain.com/api/oauth2return-Adwords.php";;
>  
> // Create a new user and set the oAuth settings
> $user = new AdWordsUser();
> $user->SetOAuth2Info(array(
>     "client_id" => 'xxx.apps.googleusercontent.com',
>     "client_secret" => "xxx"
> ));
>
> $authCode = $_REQUEST['code'];
>
> $OAuth2Handler = $user->GetOAuth2Handler();
> $user->SetOAuth2Info($OAuth2Handler->GetAccessToken($user->GetOAuth2Info(), 
> $authCode, $callbackUrl));
>
> Everything works fine, but this is all I am getting back:
>
> [oauth2Info:AdsUser:private] => Array
>
>         (
>
>             [client_id] => xxxx.apps.googleusercontent.com
>
>             [client_secret] => xxxxxxx
>
>             [access_token] => ya29.xxxxxxxxxxxxx
>
>             [token_type] => Bearer
>
>             [expires_in] => 3599
>
>             [timestamp] => 1401998014
>
>         )
>
> So I can pull the data I need, but I have to reauthorize every time.  This 
> is using an MCC.  Is there something I am missing?  
>
> Thanks for your help.
>
> Mike
>
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to