Oidc-client-js: UserManager.js getUser() returning UserManager.getUser: user not found in storage even when user is logged in

Created on 24 Oct 2018  路  11Comments  路  Source: IdentityModel/oidc-client-js

I logged in with my user using implicit flow, received the tokens, then clicked on get user, and got the following error message:
"UserManager.getUser: user not found in storage"

Any recommendations? thanks in advance.

question

All 11 comments

You mean in the sample?

Yeah I am also facing same issue. When user is logged in using implicit flow. I am triggering silent renewal on `addAccessTokenExpiring' event. So when token is getting renewed i get message "UserManager.getUser: user not found in storage" but new token generated successfully.

Not sure what causing this..Any advice?

Thanks

Hi @brockallen , yes in the sample app VanillaJS.
I do a silent sign in with iframe after signing in main window, i get the expected behavior in console :
image

But when i query user session status, i get this even though the user is logged in:
image

The idp i am using does not return session_state in tokens response, do you believe this is causing the issue ? Thanks in advance

Did you click the "end signin main window" button?

Yes i did but it does not resolve it.
Now i notice, when i sign in in main window using implicit flow, i get the access token in callback but i get "UserManager.getUser: user not found in storage", it seems the storeUser function is not working as expected.
capture

Not sure then -- i test that on all the browsers on my machine and they're working.

I have the same problem with implicit flow, the login is successful but when i try to get user the returned value is always null....

@manuelcaub It is indeed a weird behavior, i also noticed when you login successfully, do a silent signin using iframe, then click on getUser, it will return the user successfully from local storage.. But if you click on getUser directly after signin main window, it's returning null like you said.

@Nat11 thanks for your answer. In my case I have solved it calling signinRedirectCallback if the user is null

async getUser() {
    const user = await this._userManager.getUser();
    if (!user) {
      return await this._userManager.signinRedirectCallback();
    }

    return user;
}

Hi @manuelcaub , thanks for your reply. Does this code you put replace the existing getUser() in UserManager.js ? can you please give more details... Thanks.

Where are we with this issue? In all of my testing, the samples are working.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LEW21 picture LEW21  路  4Comments

bialabs picture bialabs  路  3Comments

baoduy picture baoduy  路  4Comments

pottabathini picture pottabathini  路  5Comments

eckersalld picture eckersalld  路  5Comments