Token gets invalid a few times per day
Hey its now the second token that dies today. I just create a token, use them for testing,... and after a speciffic time i just get response 401 with Error Code 1001. If I create then a new one and use them, everyting works.
Its impossible that i have reached the limit of the dayly API requests in developing (...2x/d...)
Is this a common Problem? Any soulutions?
beneste30
Posted 2 years ago·Last reply 2 years ago
6 comments
beneste30
OP2 years agoUpdate got it
beneste30
OP2 years ago@shipscript
forgot to mark you
beneste30
OP2 years agoHey thanks your reply is very helpful!
I have start reading about. the concept is the same as on JWT Token auth (post refresh and get access).
But the exact process is a bit confusing...
In the docs is written:
Set refresh_token to the refresh token value returned from the authorization code grant request.
To get a refresh token, you must mint a new User access token.
This process starts with Getting the user's consent.
(what redirects me to: eBay Developers Program ...)
so on this page:
The authorization code grant flow | eBay Developers Program
is described that i have to make before making the refres-access token request, i need to consent of the user. But i just need a authorisation Token to show them some ebay products on my page. That way sounds wrong in my oppinion and were be rly a overkill
From that "consent request" i get a refresh token returnt which i can use then in the refr-acc-request.
The following parts are understandable. I just dont understand how to get the refresh token
beneste30
OP2 years agoOk but which sense then make the user tokens if they get invalid after a few h?
So i tried to paste the client id in the Authorisation header but it also doesnt work
shipscript
·2 years ago@beneste30
Read the instructions for refreshing a token. You must set up your application to test whether the token has expired, and if it has, the application should mint a new token. Fresh tokens help prevent unauthorized access.
If you are using the grant-type "client_credentials" to access public data like the Browse API, your application should mint a new token every two hours.
https://developer.ebay.com/api-docs/static/oauth-client-credentials-grant.html
If you are using the grant-type "authorization_code" and "refresh_token" to access private data within a member's account, more steps are required to create the member's 18-month account token and your application should mint a new refresh token every two hours.
https://developer.ebay.com/api-docs/static/oauth-authorization-code-grant.html
https://developer.ebay.com/api-docs/static/oauth-consent-request.html
https://developer.ebay.com/api-docs/static/oauth-auth-code-grant-request.html
https://developer.ebay.com/api-docs/static/oauth-refresh-token-request.html
shipscript
·2 years ago@beneste30
Make sure that the token you are creating (sandbox or production) is being used on the correct platform and is the correct grant type (client_credentials vs authorization_code). Note that "client_credentials" are for your application to access public data, while "authorization_code" allows access to private user data. The bulk of eBay OAuth tokens expire in 2 hours, and require refreshing.