11-19-2023 09:14 PM
My web app just literally browses for items, thus I can get away using hte Application Token, not the User Token. However how can I et one that lasts longer than 2 hours? Everything I find on search is about refresh tokens, which seems to be related to User tokens. Some guidance is appreciated.
11-20-2023 07:24 AM
First, the API call that you are using must support only the Application token.
When your two-hour token has expired, you will need to fetch a new two-hour token. One way to do that is to create a file on your system to save the token and then either test for its expiration prior to use or wait for eBay to say the token is expired. Upon expiration, request a new token to take its place.
I have posted code for a PHP routine that fetches the two-hour API token as it nears expiration. It tests the age of the token file to see if the two hours have expired:
The code is generally readable if you need to apply to some other language