source-inc/ng-oidc-client

Returned null User object after login

Closed this issue · 7 comments

I am using oidc-client and ng-oidc-client combination for angular client and Identity server 4 as server.
Login was successful but this.oidcFacade.identity$.pipe is always returning null User object after login.

@nareshkathi let us know if that's still an issue for you.

Closing it now due inactivity.

I got null only even I call oidcFacade.getOidcUser() method
image

Hey @jawahar7 can you share a git repo with the example?

Thanks for sharing. I think we need to be more clear in our documentation or rename the function getOidcUser(). It is a bit misleading as it actually does not return the User. If you look at the return type, it is a void function. The intention is to trigger the framework to obtain the user information through OIDC.

If you pipe the exposed identity$ like

    this.identity$ = this.oidcFacade.identity$.pipe(
      tap(user => {
        console.log(user);
      })
    );

you should be able to see the console.log output of the user.

You can read more about it in the blog post:
Securing your Angular 7+ application with OIDC and NgRx

Hope that helps

Working fine. Thanks for your support