[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[ ] Feature request
[x ] Documentation issue or request
[ ] Other... Please describe:
I am trying to verify that the token renewal is working properly in my React App. The only way I have been able to do this is to simply wait 10 minutes between each test. Is there a way to invalidate or expire the token without waiting 10 minutes?
I actually wasted several hours troubleshooting after I created a policy with "Access & ID token lifetimes" set to 5 minutes. It turns out that anything lower than 10 minutes does not work. The access token from acquireTokenSilent() is simply null and no errors. It would be nice if the portal warned about this or if this library logged some warning.
I need this feature too. Looks like MSAL.js does not have much feature which is present in their ios, dotnet library.
I'm also expecting this
I randomly ran across this config option: tokenRenewalOffsetSeconds.
Included in my config under system like so:
export const msalApp = new UserAgentApplication({
auth: {
clientId: `${process.env.REACT_APP_MSAL_CLIENT_ID}`,
authority: MSAL_AUTHORITY,
validateAuthority: false,
postLogoutRedirectUri: `${process.env.REACT_APP_HOST_DOMAIN}`,
redirectUri: `${process.env.REACT_APP_HOST_DOMAIN}`,
navigateToLoginRequestUrl: false
},
cache: {
cacheLocation: 'sessionStorage',
storeAuthStateInCookie: isIE()
},
system: {
tokenRenewalOffsetSeconds: 1000
}
});
When I set the tokenRenewalOffsetSeconds to a value greater than my 10 minute token life, it refreshes the token every time I call acquireTokenSilent(). I am also able to set it to 9 minutes and it will refresh every minute. This has sped up my testing significantly!
In order to test what happens when the token is invalided server side before it expires locally, I set the tokenRenewalOffsetSeconds to -120 and then waited 10 minutes. Sure enough it does not refresh the token until 2 minutes after the token has technically expired. Good thing I tested this because my API did not complain. Now I am investigating why my API is accepting expired tokens. :-)