question

KevinAzure avatar image
KevinAzure asked ·

ID Token - Increase Timeout from Angular/MSAL

I am using Angular App with MSAL which Authenticate user through Azure AD

We are getting ID Token & Access Code in return.

BUT after 1 hour the ID Token is expiring.

Can I INCREASE the Timeout of ID Token at Client-side Or Server-side?

Please advice.

azure-active-directory
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

saurabhsh-msft avatar image
saurabhsh-msft answered ·

Id token lifetime is by default 1 hour and you can use acquireTokenSilentAsync method to renew id tokens as long as AAD user session is active. If AAD session expires the token renewal will fail making you to have an interactive call for user sign-in. You can however configure user session and id token lifetime to make the user logged in by choosing "Keep me Signed-In" as documented here. You can also configure lifetime policy for id tokens as described here.


3 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@KevinAzure Please let me know if you find above reply useful. If yes, do click on 'Mark as answer' link in above reply. This will help other community members facing similar query to refer to this solution. Thanks.

0 Votes 0 · ·

Thank you Saurab.. Will check this!

0 Votes 0 · ·

If I want to keep the token active for my long running angular page like signage or like a daemon app (angular may not support a deamon style app) , can I refresh the page every 55 minutes or before its expiry? Still someone has to login after 90 days?
A rolling window of 90 days (https://docs.microsoft.com/answers/questions/18432/azure-ad-msal-id-token-timeout-acquiretokensilent.html)

Timer2;
callAPIIntervalInMinute: number = 55*60*1000;
this.timer2 = setInterval(() => {
this.getSignageData(); //The page will be refreshed every 55 minutes.
}
}, this.callAPIIntervalInMinute);


0 Votes 0 · ·