Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use sandbox environment #11

Open
ghost opened this issue May 6, 2021 · 5 comments
Open

Unable to use sandbox environment #11

ghost opened this issue May 6, 2021 · 5 comments

Comments

@ghost
Copy link

ghost commented May 6, 2021

Hi there,

When attempting to fetch a token using the sandbox environment, the lib throws an error:

const encodedStr = base64Encode(`${ebayAuthToken.clientId}:${ebayAuthToken.clientSecret}`);
                                                     ^

TypeError: Cannot read property 'clientId' of undefined

Code I'm using w/ my sandbox creds:

const EbayAuthToken = require('ebay-oauth-nodejs-client');

const ebayAuthToken = new EbayAuthToken({
  clientId: '',
  clientSecret: '',
  redirectUri: '',
});

(async () => {
  const token = await ebayAuthToken.getApplicationToken('SANDBOX');
  console.log(token);
})();

@auctus10
Copy link

@kamajigames You need to give a filepath to your config.json.

Like this -

const EbayAuthToken = require('ebay-oauth-nodejs-client');
const ebayAuthToken = new EbayAuthToken({
    filePath: 'demo/eBayJson.json' // input file path.
})

@NFNChris
Copy link

NFNChris commented Sep 8, 2021

Although not depicted in the example code, the "env" configuration parameter ('PRODUCTION' or 'SANDBOX') is required along with clientId, clientSecret, and redirectUri. If it's not specified, the module defaults to "PRODUCTION" which is why it won't work with the sandbox environment.

@sarmadfolio3
Copy link

@kamajigames have you got the resolution? I am still stuck with the same issue

@poewt
Copy link

poewt commented Aug 3, 2023

@kamajigames have you got the resolution? I am still stuck with the same issue

Like @NFNChris mentioned try adding "env" to your EbayAuthToken like so:

const ebayAuthToken = new EbayAuthToken({
  clientId: '',
  clientSecret: '',
  redirectUri: '',
  env: 'SANDBOX', // (or PRODUCTION)
});

@jauntyjocularjay
Copy link

I added clarification on this issue to the Readme, hoping to make it more explicit. I cannot create a pull request as I am not a collaborator. The clarification can be found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants