Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On redirect, LOADING_USER and USER_EXPIRED fires just before USER_FOUND #183

Open
slutske22 opened this issue Dec 8, 2020 · 1 comment

Comments

@slutske22
Copy link

I am not sure if I am misunderstanding how things work, but I am seeing what feels like strange behavior. Once the user signs in to the OAuth provider (keycloak in my case), they are send back to the callback uri. The first actions fired from redux are as such:

Screen Shot 2020-12-07 at 2 38 23 PM

However, on reload, I get the expected behavior:

Screen Shot 2020-12-08 at 1 44 23 PM

The fact that USER_EXPIRED is called (and thereby makes store.oidc.isLoadingUser false) is confusing to me, and is causing some UI issues. Perhaps I'm not understanding some fundamental part of oidc, but how can I maintain in the store that the user is still being retrieved?

For some background, I call loadUser directly after the store is defined:

// in index.js
const store = createStore(rootReducer, <middleware>);
loadUser(store, userManager);

userManager is defined like this:

const userManagerConfig = {
  authority: `${window.location.protocol}//${window.location.hostname}:8081/auth/realms/master`,
  client_id: "vine",
  redirect_uri: `${window.location.protocol}//${window.location.hostname}${
    window.location.port ? `:${window.location.port}` : ""
  }${window.location.pathname}`,
  response_type: "code",
  scope: "openid",
  automaticSilentRenew: true,
  accessTokenExpiringNotificationTime: 20,
  revokeAccessTokenOnSignout: true,
  post_logout_redirect_uri: `${window.location.protocol}//${
    window.location.hostname
  }${window.location.port ? `:${window.location.port}` : ""}`
};

const userManager = createUserManager(userManagerConfig);
@maxmantz
Copy link
Owner

Hi,

sorry for the late reply. Your config looks good, I guess this can happen when the access token in your app state has expired, therefore USER_EXPIRED fires. Then the token gets renewed and USER_FOUND is dispached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants