Gnik
Gnik

Reputation: 7428

Angular OIDC Auth Client Logout from multiple tabs

Working with Angular and AWS Cognito.

I want to logout from all the active tabs of the browser. Using angular-auth-oidc-client for auth config. Added the below code in app.module.ts to use localStorage instead of sessionStorage.

    {
        provide: AbstractSecurityStorage,
        useClass: DefaultLocalStorageService,
    },

Logout code:

oidcSecurityService.logoff(config_id, 
        customParams: {
            client_id: myCognitoAppClientId,
            redirect_uri: 'login url',
            response_type: 'code',
            scope: 'openid profile',
            logout_uri: 'login url,
        }
    );

So when I do logout from one tab clears localStorage on another tab as well. Current tab redirects to login screen as expected.

But when I refresh another tab which got stuck. Not redirecting to login screen. If I refresh second time its authenticated and got the new token and application is loading all the pages.

No idea how it is authenticated and getting new token and getting data from the BE services.

Am I missing anything from Angular end?

Upvotes: 0

Views: 161

Answers (0)

Related Questions