Angular-auth-oidc-client: ERROR ReferenceError: 'URLSearchParams' is undefined in IE and Edge

Created on 25 Oct 2017  路  5Comments  路  Source: damienbod/angular-auth-oidc-client

Guys, I love the direction of this project. I was using your raw ts files from before it was an npm package. I recently replace those with this npm package version. In IE and Edge, issuing a login request creates this bug in the console and never goes to the Identity server login page. Here's the error with the stack:

ERROR ReferenceError: 'URLSearchParams' is undefined
"ReferenceError: 'URLSearchParams' is undefined
聽聽 at OidcSecurityService.prototype.createAuthorizeUrl (http://localhost:5003/dist/app.bundle.js:27407:9)
聽聽 at OidcSecurityService.prototype.authorize (http://localhost:5003/dist/app.bundle.js:27127:9)
聽聽 at AppComponent.prototype.login (http://localhost:5003/dist/app.bundle.js:82679:9)
聽聽 at Anonymous function (Function code:10:11)
聽聽 at handleEvent (http://localhost:5003/dist/app.bundle.js:12205:87)
聽聽 at callWithDebugContext (http://localhost:5003/dist/app.bundle.js:13666:9)
聽聽 at debugHandleEvent (http://localhost:5003/dist/app.bundle.js:13254:5)
聽聽 at dispatchEvent (http://localhost:5003/dist/app.bundle.js:8809:5)
聽聽 at Anonymous function (http://localhost:5003/dist/app.bundle.js:9420:13)
聽聽 at Anonymous function (http://localhost:5003/dist/app.bundle.js:39761:9)"

There is a conversation in Angular's github discussing how URLSearchParams is a global variable and can easily be confused with the Angular class. https://github.com/angular/angular/issues/16378
I have a sneaking suspicion that IE and Edge are finding the wrong object to load. If I get time I'll try to clone and fix and submit a Pull Request, but if you guys get to it first, it would be hugely appreciated.

bug

All 5 comments

@rpipkin thanks for reporting. This is a bug.

@damienbod The error was created by this commit: https://github.com/damienbod/angular-auth-oidc-client/commit/d0745e7a828dd7e319e848acbdeabe83419d998c, when you moved to HttpClient: first URLSearchParams was imported from Http module, while the local variable is now being used.

Has pr: #114

fixed in 3.0.2, thanks @rpipkin @robisim74

A question- how can I make sure I get this fix into my current angular app?

@mcano808 you can use the npm

https://www.npmjs.com/package/angular-auth-oidc-client

Greetings Damien

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Expelz picture Expelz  路  4Comments

brentos99 picture brentos99  路  4Comments

haidelber picture haidelber  路  3Comments

hannesrohde picture hannesrohde  路  3Comments

xaviergxf picture xaviergxf  路  3Comments