Hi

I'm currently running into API call issues whenever my access token 
expires. I've already saved the client's refresh token and I'm trying to 
figure out whether AdWords will automatically renew the access token if you 
build the session with the OAuth2 object that contains the refresh token 
details.

Here's an example,

$this->oath2 = new OAuth2([
'authorizationUri' => self::AUTHORIZATION_URI,
'tokenCredentialUri' => CredentialsLoader::TOKEN_CREDENTIAL_URI,
'redirectUri' => self::BASE_URL . self::REDIRECT_PATH,
'clientId' => self::CLIENTID,
'clientSecret' => self::CLIENTSECRET,
'scope' => self::API_SCOPE
]);
$this->oauth2->setRefreshToken($refresh_token); // let's assume 
$refresh_token was retrieved from database
$this->session = 
    (new AdWordsSessionBuilder())
    ->withDeveloperToken(self::DEVELOPER_TOKEN)
    ->withOAuth2Credential($this->oauth2)
         ->build();
// Make some API calls with AdWordsServices and $this->session

Based on the code snippet above, 

   1. Would AdWords automatically handle the expired access token, or  
   2. Do I have to explicitly check whether the access token is valid 
   (via https://www.googleapis.com/oauth2/v3/tokeninfo) and if invalid, make a 
   call (via https://www.googleapis.com/oauth2/v4/token) to get the new access 
   token?
   
Thanks.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/5a4688df-d144-400e-abb9-eaf392036f8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • Keeping the acc... Danny

Reply via email to