angular-auth-oidc-client: Not displaying LogoutURI instead going to the default page

I have few pages in my app, I have given AutoLoginGuard for all the pages other than Dashboard (default page) and logout.

Issue The logout page is not displaying. Actually it is redirecting to logout but the default page is displaying, ie dashboard

const routes: Routes = [
  { path: '', pathMatch: 'full', redirectTo: 'dashboard' },  
  { path: 'service', component: MyServiceComponent , canActivate: [AutoLoginGuard] },
  { path: 'dashboard', component: DashboardComponent },
  { path: 'logout', component: LogoutComponent }];

App.Component.ts

ngOnInit() {

    console.log("*** In app page ngOnInit()");

    this.authservice.IsAuthenticated$.subscribe(data =>{
      debugger;
      if(data == false){
        if ('/logout' == window.location.pathname) {
        }
        else{
          this.authservice.checkAuth().subscribe( result => {
            debugger;
            this.isAuthenticated = result;
            
          });
        }
      }
      else{
        this.isAuthenticated = data;
      }
    }
    );
}

app.module.ts

export function configureAuth(oidcConfigService: OidcConfigService) {
  return () =>
    oidcConfigService.withConfig({
      stsServer: 'https://localhost:5001',
      redirectUrl: window.location.origin,
      
      clientId: 'clientangular',
      scope: 'openid profile api1 offline_access',
      responseType: 'code',
      triggerAuthorizationResultEvent: true,
      postLogoutRedirectUri: 'http://localhost:4200/logout',
      
      renewTimeBeforeTokenExpiresInSeconds: 0,
      silentRenew: false,
      
      logLevel: LogLevel.Debug,
      historyCleanupOff: true,
      
    });
}

After logout image

After clicking the link, it is redirecting to logout but display dashboard again. Console log is below image

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (1 by maintainers)

Most upvoted comments

OOps sorry its my mistake! Its working. Thanks for fixing the package! All the best

Hey, check your app.component’s code and see the examples. This should fix it. If not please prove a sample repo and then we can have a look. Thanks.

https://github.com/damienbod/angular-auth-oidc-client/tree/main/projects/sample-code-flow-auto-login/src/app