eBay Token Management
Demo of API call to obtain client authorization.
Documentation
Tokens are created only when they are needed. This demo stores the token returned by eBay in a session variable. It is reused for all API calls. The token is refreshed only if it used near its expiration time or if the session variable is cleared. eBay returns the number of seconds the token is good for. We convert that to an expiration date with: time() + numSeconds - 120. We subtract two minutes to give a margin so we don't try to reuse an expired token.