Angela Lee
Angela Lee

Reputation: 77

How I can assign the lifetime of the token?

If the token is about to be expired, is there a feature to notify the user in the web UI? In addition, where do you use TokensExpiresBefore variable in the class of OpenidConnectPkceSettings (https://github.com/ITfoxtec/ITfoxtec.Identity.BlazorWebAssembly.OpenidConnect). Thanks!

Upvotes: 1

Views: 194

Answers (2)

Anders Revsgaard
Anders Revsgaard

Reputation: 4334

The ITfoxtec Identity Blazor component handles token refresh which is enabled by using the offline_access scope.

When you need to call an API the access token is requested insight the Blazor client. If the access token is timed out and token refresh is not enabled you get an TokenUnavailableException.

Upvotes: 1

Tore Nestenius
Tore Nestenius

Reputation: 19941

Its up to you to detect and handle tokens that are about to expire. Some libraries can refresh it for you using the refresh token and in other cases you have to deal with it your self.

Either you keep using the token until the API you sent it to returns with error or you keep track of the expire-time and refresh the access it just before it is about to expire using the refresh token.

Upvotes: 0

Related Questions