eBay / ebay-oauth-nodejs-client

🔑 Generate an OAuth token that can be used to call the eBay Developer REST APIs.
https://ebay.github.io/ebay-oauth-nodejs-client/
Apache License 2.0
62 stars 29 forks source link

`getApplicationToken(...) is not a function` is definitely a function #29

Open jauntyjocularjay opened 1 week ago

jauntyjocularjay commented 1 week ago

I am having some trouble implementing this library. I think the readme could use some clarification. One of the pieces of data I am getting back in found in the console output as described in my gist:

EbayOauthToken {
  credentials: {
    PRODUCTION: {
        ...
        env: 'PRODUCTION',
        baseUrl: 'api.ebay.com'
    }
  },
  grantType: ''
}

I saw from another issue open that these properties (env, baseURL) need to be overridden.

jauntyjocularjay commented 1 week ago

I updated my parameters object

parameters = {
        clientID: ENV.ebay.sandbox.clientID,
        clientSecret: ENV.ebay.sandbox.clientSecret,
        redirectUri: 'Zapplugin-Zapplugi-zapplu-mgrkif',
        env: Constant.ebay.sandbox.env,
        baseUrl: Constant.ebay.sandbox.base_url
    }

...

const ebayAuthToken = new EbayAuthToken(parameters)

And I am still getting the same error:

EbayOauthToken {
  credentials: {
    SANDBOX: {
      clientID: ---,
      clientSecret: ---,
      redirectUri: 'Zapplugin-Zapplugi-zapplu-mgrkif',     
      env: 'SANDBOX',
      baseUrl: 'api.sandbox.ebay.com'
    }
  },
  grantType: ''
}

TypeError: getApplicationToken(...) is not a function
    at file:///path/to/project/components/ebay/ebay.authtoken.mjs:47:1  
jauntyjocularjay commented 1 week ago

Update: To make matters stranger, the errors are thrown on the wrong line. It doesn't seem to be doing it anymore, maybe closing VSCode and GitBash helped, but it was saying the error was 2-3 lines below where it was intending to throw the error.