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

[Bug]: Fail to authenticate in callback component.

Open josu-b-dev opened this issue 1 year ago • 3 comments

Version

18.0.2

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

I'm getting : `ERROR TypeError: Cannot read properties of null (reading 'last_login_ip')` during the checkAuth() call. The whole `userData` object is returning `null`.

Steps to reproduce the behavior

1. Set callBack component.
2. call this.oidcSecurityService.checkAuth()
3. add console.log() inside checkAuth() call to see returning data

It fails the authentication and returns null userData.

A clear and concise description of what you expected to happen.

Returns isAuthenticated: true and the userData correctly, as it did in version 18.0.1 with the exact same code.

Additional context

Our callback component:

export class CallbackComponent {
  constructor(
    private router: Router,
    private oidcSecurityService: OidcSecurityService,
    private tokenService: TokenService,
    private authService: AuthService,
    private auditService: AuditService,
    private activatedRoute: ActivatedRoute,
  ) {
    this.oidcSecurityService.checkAuth().subscribe({
      next: (data) => {
        console.log(data); // returns userData null and isAuthenticated false in v18.0.2
        console.log(activatedRoute); // returns the same in v18.0.2 and 0.1
        const { userData, accessToken } = data;
        void this.router.navigate(["consult"]);
      },
    });
  }
}

Error Message and checkAuth() returning data console.log(): Screenshot 2024-12-26 180530

josu-b-dev avatar Dec 26 '24 23:12 josu-b-dev

Hello @josu-b-dev, can you please check if you have similar behavior to #2040?

rammba avatar Jan 06 '25 08:01 rammba

Is that issue still existing? Do you have a sample repo?

FabianGosebrink avatar Mar 28 '25 20:03 FabianGosebrink

Any update about this? I am facing this issue

alikdelrisco avatar Sep 24 '25 18:09 alikdelrisco