After endless problems with the API, I have got to the stage where I can;
1. Get the authorisation URL and have the user accept access.
2. Retrieve the authorisation code.
3. Use auth code to get refresh token + access token.
4. Access the data using the GetCampaigns method.
However, once this first token expires, I can't seem to get a new access
token.
The code below is the current one I am testing;
require_once dirname(__FILE__) . '/init.php';
$user = new AdWordsUser();
$OAuth2Handler = $user->GetOAuth2Handler();
$user->RefreshAccessToken($user->GetOAuth2Info());
which results in the following error;
Uncaught SoapFault exception: [soap:Server]
[AuthenticationError.OAUTH_TOKEN_INVALID @ ; trigger:''] in
/usr/www/users/dragorefcc/api/AdWords/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php:216
Stack trace: #0
/usr/www/users/dragorefcc/api/AdWords/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php(216):
SoapClient->__soapCall('get', Array, NULL, Array, Array) #1
/usr/www/users/dragorefcc/api/AdWords/src/Google/Api/Ads/AdWords/v201601/CampaignService.php(7902):
AdsSoapClient->__soapCall('get', Array) #2
/usr/www/users/dragorefcc/advertising/getCampaigns.php(15):
CampaignService->get(Object(Selector)) #3
/usr/www/users/dragorefcc/advertising/index.php(61):
include('/usr/www/users/...') #4 {main} thrown in
/usr/www/users/dragorefcc/api/AdWords/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php
on line 216
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
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/a6df9ea1-b335-44d7-8efe-9e2fe10c392b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.