Token Expiration Value Not Reflected by expiresIn Property

Overview

One way to check if an existing session is still valid is to access the expiresIn property in the access token. However, when setting the Token expiration (Seconds) found under API -> <specific API> -> Token Settings to a specific value, this value does not get reflected at the time of retrieving the value using React-native SDK.

The SDK used is react-native-auth0 SDK version 2.16
The snippet of code to retrieve the token expiration time is as follows:

const getCreds = async () => {
        const creds = await getCredentials();
        return creds;
    };
const creds = await getCreds();
const tokenExpirationDate = new Date(creds.expiresIn * 1000);


This article explains how to include the Token expiration value.

Applies To
  • Token Expiration
  • expiresIn Property
Solution
To have this value reflected correctly, create a custom API and set the correct value for the "audience" parameter in the call to authorize. When this audience parameter is included, the value of the "expiresIn" is updated accordingly.

Recommended content

No recommended content found...