Gregster
Gregster

Reputation: 59

Silent token renew - Angular Auth OIDC

I need to implement silent token renew without page refresh/reloading when token is almost expired using angular-auth-oidc-client.
I am using Azure AD for storing users accounts.

For authorization i am using angular-auth-oidc-client

this.oidcSecurityService.authorize()

In official samples for Azure and for general purpose i found cases for refreshSession as this:

  forceRefreshSession(): void {
    this.oidcSecurityService
      .forceRefreshSession()
      .subscribe((result) => console.warn(result));
  }

But it refreshes page and all user progress in Web App is loosen in this case.
Here is my configuration of AuthModule:

      config: {
        authority: `...`,
        redirectUrl: `...`,
        postLogoutRedirectUri: `...`,
        clientId: ...,
        scope: `openid profile email offline_access api://...`,
        responseType: 'id_token',
        silentRenew: true,
        useRefreshToken: true,
        renewTimeBeforeTokenExpiresInSeconds: 30,
        logLevel: LogLevel.Debug
      }

Upvotes: 0

Views: 276

Answers (0)

Related Questions