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

No state in response for one specific user #1617

Open
inomn opened this issue Aug 8, 2024 · 1 comment
Open

No state in response for one specific user #1617

inomn opened this issue Aug 8, 2024 · 1 comment
Labels
Keycloak Identity question Further information is requested

Comments

@inomn
Copy link

inomn commented Aug 8, 2024

Hi. I'm using Keycloak 20 with oidc-client-ts 3.0.1 + react-oidc-context 3.1.0.
For most of the users including myself everything works fine, except from one user. The issue is i don't have access to his machine so I can't test in anyhow. Can anyone suggest me the way to debug this issue or maybe point out to the errors i have in my setup?

I'm getting "No state in response" report, thrown from here:

  async readSigninResponseState(url, removeState = false) {
    const logger2 = this._logger.create("readSigninResponseState");
    const response = new SigninResponse(UrlUtils.readParams(url, this.settings.response_mode));
    if (!response.state) {
      logger2.throw(new Error("No state in response"));
      throw null;
    }

Config:

const redirectUrl = `${window.location.origin}${window.location.pathname}`;

export const oidcConfig: AuthProviderProps = {
  authority: `${config.oidc.authority}/realms/rouvia`,
  client_id: 'frontend',
  redirect_uri: redirectUrl,
  silent_redirect_uri: `${window.location.origin}/silent-callback`,
  post_logout_redirect_uri: window.location.origin,
  response_type: 'code',
  scope: 'openid profile email offline_access',
  automaticSilentRenew: true,
  loadUserInfo: true,
  onSigninCallback: (): void => {
    window.history.replaceState({}, document.title, window.location.pathname);
  },
};

export const userManagerConfig: UserManagerSettings = {
  ...oidcConfig,
  userStore: new WebStorageStateStore({ store: window.localStorage }),
};

SilentCallback is just a simple

useEffect(() => {
    const userManager = new UserManager(userManagerConfig);

    userManager.signinSilentCallback().catch((error) => {
      captureException(error);
    });
  }, []);

Thanks in advance.

@Badisi
Copy link
Contributor

Badisi commented Aug 8, 2024

If it's working for the majority but one, it means your config should be fine.
For the one where it's not working, the problem is either the "user" or the "machine".

So:

  • you could ask someone else to log-in on the same machine as the user
    -> if it works, it means the issue is related to the user, so maybe a Keycloak issue with the user account
  • you could ask the user to try on a different web-browser / machine
    -> if it works, it means the issue is related to the original web-browser / machine - and you start investigating from there (available updates ?, etc.)

@pamapa pamapa added question Further information is requested Keycloak Identity labels Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Keycloak Identity question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants