pajaydev / ebay-node-api

eBay API Client for node
https://pajaydev.github.io/ebay-node-api
MIT License
131 stars 76 forks source link

Error: invalid_client: client authentication failed #81

Closed machineghost closed 4 years ago

machineghost commented 4 years ago

When I try to follow the basic example I can't even get past getAccessToken:

const clientID = 'my EBay "Account SID"';
const clientSecret = 'my EBay "Auth Token"';
const body = {
  grant_type: 'client_credentials',
  scope: 'https://api.ebay.com/oauth/api_scope'
};
const env = 'SANDBOX';
const ebay = new Ebay({ body, clientID, clientSecret, env });

export const search = async productName => {
  const { error, error_description } = await ebay.getAccessToken();

When I run the above, I get an error of "invalid_client", with a description of "client authentication failed". However, I'm copy/pasting my exact EBay account SID/auth token, so unless I'm using the wrong auth variables (the only other ones EBay gives me are the read-only ones) I'm not sure what I could be doing wrong.

Any thoughts?

pajaydev commented 4 years ago

@machineghost Thanks for using this library. Below code is working for me

const Ebay = require('ebay-node-api');

const clientID = '--- sandbox client id ---';
const clientSecret = '--- sandbox client secret---';
const body = {
    grant_type: 'client_credentials',
    scope: 'https://api.ebay.com/oauth/api_scope'
};
const env = 'SANDBOX';
const ebay = new Ebay({ body, clientID, clientSecret, env });

(async () => {
    const token = await ebay.getAccessToken();
    console.log(token);
})();

Try using this code. If it's still not working, make sure that you are using sandbox client id and secret key ?.

Let me know if you need any help.

machineghost commented 4 years ago

Thanks a bunch for the response. I think I got confused ang got a "web services auth token", which is not the same as an API token (why they have both is beyond me). I signed up for the developer program (separately) and am now waiting for access to that, which should (hopefully) give me working credentials.

I'll let you know if that doesn't work, but hopefully it will. Thanks again.

pajaydev commented 4 years ago

Cool thanks 👍