-
Notifications
You must be signed in to change notification settings - Fork 222
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
How to solve this error: No state in response #971
Comments
Your response mode is not query but fragment: |
That was feasible and the previous error no longer occurs, but now I have received another error message: I have checked the corresponding source code according to the error message, and I feel confused why the authority that I specified in the configuration is inconsistent with the state.authority(I noticed that this state seems to be read from my configuration.) |
You may need to enable logging, you can do like here described https://authts.github.io/oidc-client-ts/#logging. This and debugging + looking into session and local storage should help you find your issue... |
I started the logging as per your guidance, and I see a lot of output in the browser. Some of it is quite confusing. One message reads as follows: "[WebStorageStateStore] remove('9ef30a7377aa42058ceaf1264fb71be5'): begin." Does this mean that the state is being removed from local storage? |
Yes, old stale states are removed... The state works like:
|
是不是使用HashRouter,redirect_uri中包含字符"#“,导致不能从url中正确的读取state参数的值 |
Means: @LouLamSan You are using |
I got the same issue, although I'm not using hash router. My settings is:
|
Thank you for your guidance. I have modified the configuration to "response_mode: 'fragment'", but the issue still has not been resolved. |
To track your issue: debug/log where the state is stored: oidc-client-ts/src/OidcClient.ts Lines 134 to 135 in ae22167
Here it is read back from the store: oidc-client-ts/src/OidcClient.ts Lines 271 to 277 in ae22167
Maybe it is useful to add |
Could this be a browser problem? WebKit seems to have some issues when accessing the sessionstorage to quickly before redirecting, as mentioned here.
This might also be related to an old issue from oidc-client-js... |
If y'all are having the same issue as me - using a SPA in hash-mode router, which will make problems with the URL params parsing: As you can see, the
but in hash mode:
Fragment parsing is thus not appropriate for this case. (and |
Please have a look at this issue #734 (comment). Read through the thread. Summary:
|
This issue (question) staled some time ago, closing it for now. |
hi,I am using the latest version of oidc-client.ts, when trying to login and get the token, it prompts me an error: "No state in response". Could you please advise how to solve this issue?
The configuration in my client is as follows:
const config = {
authority: 'https://localhost:7150/',
client_id: 'client1',
redirect_uri: ${window.location.origin}/#/callback,
response_type: 'code',
scope: 'openid profile api',
response_mode: 'query'
}
and the error message like this:
Error: No state in response
at OidcClient.readSigninResponseState (OidcClient.ts:155:26)
at OidcClient.processSigninResponse (OidcClient.ts:173:48)
at UserManager._signinEnd (UserManager.ts:442:51)
at UserManager.signinRedirectCallback (UserManager.ts:174:33)
at Proxy.created (callback.vue:19:31)
at callWithErrorHandling (runtime-core.esm-bundler.js:173:36)
at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:182:21)
at callHook (runtime-core.esm-bundler.js:3608:5)
at applyOptions (runtime-core.esm-bundler.js:3510:9)
at finishComponentSetup (runtime-core.esm-bundler.js:7387:9)
the callback url like this:
http://localhost:5007/#/callback?code=9F399AF8C82E4F458A5B1A37C79ADF28&state=b97ddcf6aa584df4a320e3022234bf75
The text was updated successfully, but these errors were encountered: