Renewing a Session Token in Mediafire API Calls Using Java

186 Views Asked by At

I'm practicing web services programming with the Mediafire API. I'm able to get info using version 1 token. Is there anyway to automate session token renewal after ten minutes in my code? Currently, I'm just re-running my build when I need a new token.

1

There are 1 best solutions below

0
On

You would have to add the API call to renew session token in your code when you receive a "session token invalid or expired" response.

The API uri is:

/api/user/renew_session_token.php

parameters:

session_token (the session token)
response_format (your preferred response format)

The API description:

Refreshes the lifespan of a Session Token v1 session token to ten minutes or returns a new Session Token v1 session token with a lifespan of ten minutes. Session tokens less than five minutes old are returned without being refreshed.