-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
Issue
- Issue
- Enhancement / Improvement
Steps to reproduce
Ebay has introduced a new requirement for the token to be set in header property X-EBAY-API-IAF-TOKEN
.
See: https://developer.ebay.com/Devzone/shopping/docs/CallRef/GetSingleItem.html
To reproduce, run the example for getShippingCosts and the following error will be shown.
Expected Behavior
No errors, return of shipping cost.
Actual Behavior
error: [
{
"ShortMessage": "Token not available in request.",
"LongMessage": "Token not available in request. Please specify a valid token as HTTP header.",
"ErrorCode": "1.33",
"SeverityCode": "Error",
"ErrorClassification": "RequestError"
}
I think the update to eBay policy regarding token in the header X-EBAY-API-IAF-TOKEN
will have an affect on some other of the functions.
Modify each failing fnction like getShippingCosts
to include something
if (!this.options.appAccessToken)
throw new Error('Missing Access token, Generate access token');
const auth = 'Bearer ' + this.options.appAccessToken;
return getRequest(url, auth).then(...
And,
const getRequest = (url, token = undefined) => {
if (url.includes('http://')) httpRequest = require('http');
const options = {
headers: {},
};
if (token) {
options.headers = {
'X-EBAY-API-IAF-TOKEN': token,
};
}
return new Promise((resolve, reject) => {
httpRequest.get(url, options, (res) => {...
What do you think is a good solution to this?
Metadata
Metadata
Assignees
Labels
No labels