I am using this call to get a token:
$service = new OAuthServices\OAuthService([
'credentials' => $this->cred['Setting']['credentials'],
'ruName' => $ru_name,
'sandbox' => $this->cred['Setting']['sandbox']
]);
$response = $service->getAppToken();
I am getting a Status code of 200 and a token in the response. However when I use this token with the same credentials for ANY call I am getting an error. Here is an example of a call:
$service = new TradServ\TradingService([
'credentials' => $this->cred['Setting']['credentials'],
'authorization' => $token,
'sandbox' => $this->cred['Setting']['sandbox'],
'siteId' => $this->siteID,
]);
$suggestedCategories = $service->getSuggestedCategories(
new TradTypes\GetSuggestedCategoriesRequestType([
'Query' => $name
])
);
And this is the error I am getting:
[ShortMessage] => Invalid IAF token. [LongMessage] => IAF token supplied is invalid. [ErrorCode] => 21916984 [SeverityCode] => Error [ErrorClassification] => RequestError
I have tried setting up both a sandbox and production account as well as having oAuth on and off. I'm sure there is something simple I am missing. Does any one have any recommendations for troubleshooting this?