Skip to content

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

Description

@slutske22

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);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions