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