question

hookedontronics avatar image
0 Likes"
hookedontronics asked

Not able to get User Token

Hi, I received the user consent and the code from the response. I am trying to get the User Token to make further call. Request: curl --location --request POST ' https://api.ebay.com/identity/v1/oauth2/token' \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --header 'Cookie: ebay=%5Esbf%3D%23%5E; dp1=bu1p/QEBfX0BAX19AQA**62c575cd^' \ --data-urlencode 'grant_type=authorization_code' \ --data-urlencode 'code= ' \ --data-urlencode 'redirect_uri=Tirnav_Solution-TirnavSo-UseCas-vlepyt' The response i get from the API: { "error": "invalid_grant", "error_description": "the provided authorization grant code is invalid or was issued to another client" } I am following all the exact steps from the eBay documentation but not able to figure out the issue. Our current application is using Auth'n'Auth for Java SDK and now we want to switch to REST API. Can this be the issue since we are using Auth'n'Auth?
user tokenoauth tokenuser token sandbox problem
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

hookedontronics avatar image
0 Likes"
hookedontronics answered
@michab2003 Can you pls help?
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

michab2003 avatar image
0 Likes"
michab2003 answered
hey @hookedontronics, working with OAuth tokens can be annoying, especially, because they only have a lifetime of 2 hours. so you are constantly forced to refresh them. therefor I created myself a little application I call "token refresher". it´s a stand-alone PHP/MySQL/Laravel app that does nothing more than checking every minute if a token needs to get refreshed, in fact very simple. but with that, you always have a working token and don´t need to care about the whole process getting new tokens. because I use PHP and existing packages, I never had to build complicated curl commands. in case my little app might help you, feel free to contact me: info@macropage.de. cheers, micha
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

hookedontronics avatar image
0 Likes"
hookedontronics answered
@michab2003 i followed your article and replicate the step using POSTMAN but i get the below error: { "error": "invalid_grant", "error_description": "the provided authorization grant code is invalid or was issued to another client" } I tried too with my Java code but still get the same error. I am not sure what i am missing. Do you know more about this error, in what case this is thrown? Thanks, Jayesh
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

michab2003 avatar image
0 Likes"
michab2003 answered
hi, okay, let's start from the beginning: please log into your developer account, and open the API explorer: https://developer.ebay.com/my/api_test_tool?index=0&env=production ![alt text][1] and try to get an oauth-token here with clicking on "Get OAuth Application Token", then try to make any REST API call with that token. this is a very basic test and this should work, if not, there are major issues - and you should contact eBay developer directly. be aware, that you only test calls, you have a scope for: https://developer.ebay.com/my/keys --> below your keys, click on "OAuth Scopes" and check you have Scopes and you only test calls, that fit into these scopes. cheers, micha [1]: /storage/temp/2889-nglqobu1.png

nglqobu1.png (37.8 KiB)
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.