Oidc-client-js: Error: No state in response

Created on 11 Mar 2018  路  13Comments  路  Source: IdentityModel/oidc-client-js

I tink this is an angular 5& 6 related error .
With angular 5.2.7 work fine.
I create a ng5 branch and update angular to latest 5.2.8 and the error com in!

question

Most helpful comment

To import the unminified code for debugging, you can use
import { UserManager, User, UserManagerSettings } from 'oidc-client/lib/oidc-client';

This is also somewhat related to #238 although the fix there to add the trailing slash to the redirect uri doesn't help. I haven't been able to find out why this is happening after updating to Angular 5.2.8 but downgrading back to 5.2.7 fixed the problem for me and the state was able to be parsed from the url by oidc-client

All 13 comments

Sounds like an angular problem then.

Same problem here. works fine with angular 5.2.7 but not with 5.2.8.

How to add oidc-client.js instead of oidc-client.min.js to package.json so that can trace the bug?

To import the unminified code for debugging, you can use
import { UserManager, User, UserManagerSettings } from 'oidc-client/lib/oidc-client';

This is also somewhat related to #238 although the fix there to add the trailing slash to the redirect uri doesn't help. I haven't been able to find out why this is happening after updating to Angular 5.2.8 but downgrading back to 5.2.7 fixed the problem for me and the state was able to be parsed from the url by oidc-client

Angular made breaking changes in the 5.2.8 version.

Quick fix:

window.location.hash = decodeURIComponent(window.location.hash);

Greetings Damien

Angular made breaking changes in the 5.2.8 version.

So much for semver

I am getting this same issue. I went from 5.0.2 to 5.2.8 and our oidc-client started to fail to grab the state from the redirect response. Downgrading to 5.2.7 fixed the issue.

@damienbod I added that, but still wasn't able to get this to work with angular 5.2.8.

Seems like it is working with angular 5.2.9

Closing. If you still have issues, feel free to reopen.

I am getting this same error with Angular 7.1.0. Not sure its Angular issue or oidc-client ?
Below is the error

ERROR Error: Uncaught (in promise): Error: No state in response
Error: No state in response
at UserManager.processSigninResponse (oidc-client.min.js:3)
at UserManager._signinEnd (oidc-client.min.js:3)
at UserManager.signinRedirectCallback (oidc-client.min.js:3)
at AuthService.push../src/app/auth/auth.service.ts.AuthService.completeAuthentication (auth.service.ts:75)
at AppComponent.push../src/app/app.component.ts.AppComponent.login (app.component.ts:46)
at Object.eval [as handleEvent] (AppComponent.html:13)
at handleEvent (core.js:21673)
at callWithDebugContext (core.js:22767)
at Object.debugHandleEvent [as handleEvent] (core.js:22470)
at dispatchEvent (core.js:19122)
at UserManager.processSigninResponse (oidc-client.min.js:3)
at UserManager._signinEnd (oidc-client.min.js:3)
at UserManager.signinRedirectCallback (oidc-client.min.js:3)
at AuthService.push../src/app/auth/auth.service.ts.AuthService.completeAuthentication (auth.service.ts:75)
at AppComponent.push../src/app/app.component.ts.AppComponent.login (app.component.ts:46)
at Object.eval [as handleEvent] (AppComponent.html:13)
at handleEvent (core.js:21673)
at callWithDebugContext (core.js:22767)
at Object.debugHandleEvent [as handleEvent] (core.js:22470)
at dispatchEvent (core.js:19122)
at resolvePromise (zone.js:814)
at resolvePromise (zone.js:771)
at zone.js:873
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:16147)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at drainMicroTaskQueue (zone.js:595)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:500)
at invokeTask (zone.js:1540)

@nareshkathi any luck with the above issue ?

I have resolved this in Vue js spa application by putting traling slash and by replacing the # to ? in the URL params

Changed:
http://localhost:3000/callback/#id_token=eyJhbGciOiJSUzI1NiIsImtpZCI6IjJhMjQ2N2U0YTIwODExMGViODM4OTY1NzJhN2MxMGFmIiwidHlwIjoiSldUIn0.eyJuYmY

To:
http://localhost:3000/callback/?id_token=eyJhbGciOiJSUzI1NiIsImtpZCI6IjJhMjQ2N2U0YTIwODExMGViODM4OTY1NzJhN2MxMGFmIiwidHlwIjoiSldUIn0.eyJuYmY

Worked for me :)

In Callback

if (window.location.hash) {
window.location.hash = decodeURIComponent(window.location.hash).replace('#', '?');
}

Was this page helpful?
0 / 5 - 0 ratings