03-07-2023 04:07 PM
I'm getting this error when trying to use OAUTH, i've checked and my key is in the right format i.e it does not start with "code="
{"error":"invalid_grant","error_description":"the provided authorization grant code is invalid or was issued to another client"}
the token from get_token looks like this
v^1.1#i^1#f^0#p^1#r^0#I^3#t^H4sIAAAAAAA.......................
Any help is much appreciated!
import EbayAuthToken from 'ebay-oauth-nodejs-client';
Solved! Go to Best Answer
03-07-2023 04:37 PM
ebayAuthToken.getApplicationToken is for obtaining an Application token. Which is a separate thing from a user token.
What you are looking for is ebayAuthToken.generateUserAuthorizationUrl(environment, scopes[, options])
You then load the resulting URL in a browser, log in, and once you are logged in, the URL in the browser will then have a code= in it. You grab the stuff between the code= & and submit that to exchange_authorization_code_for_access_token, which will then result in the User access token
It will also return a refresh token along with it, which you can then use
ebayAuthToken.getAccessToken(environment, refreshToken, scopes)
to refresh the access token without logging back in.
03-07-2023 04:37 PM
ebayAuthToken.getApplicationToken is for obtaining an Application token. Which is a separate thing from a user token.
What you are looking for is ebayAuthToken.generateUserAuthorizationUrl(environment, scopes[, options])
You then load the resulting URL in a browser, log in, and once you are logged in, the URL in the browser will then have a code= in it. You grab the stuff between the code= & and submit that to exchange_authorization_code_for_access_token, which will then result in the User access token
It will also return a refresh token along with it, which you can then use
ebayAuthToken.getAccessToken(environment, refreshToken, scopes)
to refresh the access token without logging back in.
03-11-2023 12:31 PM
Thank you so much for your reply!
It cleared up a lot of confusion regarding the different tokens. In my opinion the documentation is extremely lacking and confusing. I study engeering in this field and I do way more complicated things daily but its's very hard with the lacking documentation.