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

Getting "No matching state found in storage" error #1487

Open
YogiDhingani27 opened this issue Apr 30, 2024 · 4 comments
Open

Getting "No matching state found in storage" error #1487

YogiDhingani27 opened this issue Apr 30, 2024 · 4 comments
Labels
Keycloak Identity question Further information is requested

Comments

@YogiDhingani27
Copy link

When I'm trying to visit a url which has a code as a query param then authentication is failing and giving this error.

Other urls are working fine for ex: http://localhost:3004/integration

Not working url:

http://localhost:3000/integration?state=%7B%22uuid%22:%20%1234%22,%20%22platform%22:%20%22google%22%7D&code=1233434&scope=email%20profile%20https://www.googleapis.com/auth/userinfo.profile%20https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/drive.readonly%20openid&authuser=0&hd=werwer.com&prompt=consent

image

Note: Excluding url having code as a query parameter other urls are working fine.

I want a code query parameter in my url for OAuth related authentication.

@YogiDhingani27
Copy link
Author

UserManager Configuration:

export const userManager = new UserManager({ authority: authority, client_id: clientId, redirect_uri: window.location.origin + window.location.pathname, post_logout_redirect_uri: window.location.origin, monitorSession: true });

I'm using keycloak for authentication.

@pamapa
Copy link
Member

pamapa commented May 6, 2024

You will need to debug/log your specific application issue. Using https://authts.github.io/oidc-client-ts/#md:logging.

When the authentication process starts this library add a state to the session storage, this state later when the callback is received must be found again.

Store: https://github.com/authts/oidc-client-ts/blob/main/src/OidcClient.ts#L145
Read: https://github.com/authts/oidc-client-ts/blob/main/src/OidcClient.ts#L159

@YogiDhingani27
Copy link
Author

@pamapa I'm using keycloak for authentication there is nothing i can debug. Initiallly when i hit the url, keycloak will automatically append the code into url for authentication purpose. So i think oidc is considering the wrong code for authentication as above mentioned. i have a two code keys.

And above mentioned url is working if i'm using react-keycloak/web.

@vvikene
Copy link

vvikene commented Aug 1, 2024

Are you doing a round trip every time you visit a page?
You are using whatever page visited as the redirect callback url.. how do you check if it's a redirect callback or not?

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
3 participants