cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get an Application Token that lasts longer than 2 hours?

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.

Message 1 of 2
latest reply
1 REPLY 1

How to get an Application Token that lasts longer than 2 hours?

@ryacamiller0 

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: 

https://community.ebay.com/t5/Token-Messaging-Sandbox-related/Sample-PHP-for-generating-and-renewing...  

The code is generally readable if you need to apply to some other language

ShipScript has been an eBay Community volunteer since 2003, specializing in HTML, CSS, Scripts, Photos, Active Content, Technical Solutions, and online Seller Tools.
Message 2 of 2
latest reply