bhushankummar / eBay-node-client

Ebay NodeJS Wrapper
MIT License
55 stars 66 forks source link

Use Oauth2 token in trading API #34

Open ipengli opened 4 years ago

ipengli commented 4 years ago

Seems the trading API in the package is using AuthNAuth token. Is there a way we can use Oauth2 token here? eBay seems require X-EBAY-API-IAF-TOKEN in the header, any chance we can add it to the header when sending out the request? Any idea appreciated!

akiraro commented 3 years ago

I think there is no method or API available to set the request header, but what you could do is to modify the eBayMethod.js file and add the headers to support Ouath2

            var options = {headers: objectAssign(opts.headers, spec.headers)};
            options.headers['X-EBAY-API-IAF-TOKEN'] = '<your user oauth2>'
            options.useBody = spec.useBody || false;
            options.authorization = spec.authorization || '';
            options.contentType = spec.contentType || '';