0

I'm using the oidc-client library. After the Login, in the call back I call signinRedirectCallback(), but the User is not immediately loaded and I cannot redirect to the Protected page until is loaded. I tried to add router.navigateByUrl('/protected'); in the events.addUserLoaded but when it runs, it returns an error: TypeError: Cannot read property 'navigateByUrl' of undefined.

1 Answers1

0

What do you mean by user is not loaded, signinRedirectCallback() returns a promise, this will return you a promise.

if you do like below, you will get user object immediately.

yourOidcManager.userManager.signinRedirectCallback().then(user => {

});

Look at this https://github.com/IdentityModel/oidc-client-js/blob/dev/src/UserManager.js#L98

hashbytes
  • 769
  • 1
  • 8
  • 26