angular-auth-oidc-client icon indicating copy to clipboard operation
angular-auth-oidc-client copied to clipboard

[Question]: Why does my application always redirects to OIDC server after page refresh instead of use local session data

Open wzoet opened this issue 1 year ago • 1 comments

What Version of the library are you using? ^14.1.4

Question When refreshing the angular application page in a webbrowser after logging in, the user is always redirected to the authentication page first. As a session still exists, the user is redirected back directly, but it feels somehow as too much redirects as all information is already available in session storage from the first view and the access token is still valid.

my first lines in app.component are

this.oidcSecurityService.getConfiguration().subscribe((result) => this.oidcAuthority = result.authority);
this.oidcSecurityService.checkAuth().subscribe(response => {console.log(response)});

but the console logs that isAuthenticated=false.

in our guards we also use this.oidcSecurityService.isAuthenticated$, but also there isAuthenticated is false.

after being redirected to the login provider and back, everything works as planned.

I presume I am missing something, but what should that be?

Thanks in advance!

wzoet avatar Jun 21 '23 18:06 wzoet

Hello wzoet i had also same issue i fixed this issue by adding the below code

step:1 Create the Localstorage class image

step2 : add that class in the configuration under storage section image

step3:add the provide in appmodule.ts import { AbstractSecurityStorage } from 'angular-auth-oidc-client' image

trinath-katari avatar Aug 04 '23 12:08 trinath-katari