Search code examples
reactjsauthenticationadal

Automatic token refresh after 1 hour . React-adal


import { AuthenticationContext } from "react-adal";
import config from "./config.json"
const { clientId, tenantID, redirectUrl, logoutUrl } = config;

const adalConfig = {
  tenant: "abc.xyz.com",
  clientId: clientId,
  redirectUri: redirectUrl,
  endpoints: {
    api: tenantID,
  },
  postLogoutRedirectUri: logoutUrl,
  cacheLocation: "sessionStorage",
};

export const authContext = new AuthenticationContext(adalConfig);

This is my adalConfig.js file. As of now the token gets expired after an hour which is the default property and i do not want that to happen in my use case. I want the token to be valid atleast for a day or it should get refreshed automatically when it expires. I have not used react-adal ever before. Do not we have any property like cacheLocation, postLogOutRedirectUri, CliendId etc like mentioned in the above code for the token expiry time ?? named Please help me with this. Thanks in advance. Any sort of lead is appreciated.


Solution

  • When expired a new ID token should be acquired silently if the session or KMSI cookie is present. You can control the former using Conditional Access User sign-in frequency. Since this is a paid feature, please take a look to the License requirements.