Skip to content

Update to 26.2.2: URL encoded redirect urls in Angular application #241

@djoho

Description

@djoho

Describe the bug

After Upgrade to keycloak-js 26.2.2 a page refresh in the browser leads to issues with the Angular router. It seems that the redirect urls arrive in url encoded form in the router like '/%2Fadmin%2Fmaintenance%2Fscripts%3D' whereas with keycloak-js 26.2.1 they were in the form '/admin/maintenance/scripts'

Version

26.2.2

Expected behavior

With keycloak-js 26.2.1, the Angular router gets the redirect urls without url encoding. This is working fine.

If I am on a page with the url http://localhost:4500/#/admin/maintenance/scripts and perform a page refresh in the browser, the Angular router gets the following events.

Router Event: NavigationStart router_module.mjs:1418:19 NavigationStart(id: 1, url: '/admin/maintenance/scripts') router_module.mjs:1419:19 Object { id: 1, url: "/admin/maintenance/scripts", type: 0, navigationTrigger: "imperative", restoredState: null } router_module.mjs:1420:19 Angular is running in development mode. debug_node.mjs:18311:17 .... Router Event: NavigationEnd router_module.mjs:1418:19 NavigationEnd(id: 1, url: '/admin/maintenance/scripts', urlAfterRedirects: '/admin/maintenance/scripts') router_module.mjs:1419:19 Object { id: 1, url: "/admin/maintenance/scripts", urlAfterRedirects: "/admin/maintenance/scripts", type: 1 }

Actual behavior

With keycloak-js 26.2.2, the Angular router gets the redirect urls in url encoded form, which it cannot handle.

If I am on a page with the url http://localhost:4500/#/admin/maintenance/scripts and perform a page refresh in the browser, the Angular router gets the following events.

Router Event: NavigationStart router_module.mjs:1418:19 NavigationStart(id: 1, url: '/%2Fadmin%2Fmaintenance%2Fscripts%3D') router_module.mjs:1419:19 Object { id: 1, url: "/%2Fadmin%2Fmaintenance%2Fscripts%3D", type: 0, navigationTrigger: "imperative", restoredState: null } router_module.mjs:1420:19 Angular is running in development mode. debug_node.mjs:18311:17 Router Event: NavigationError router_module.mjs:1418:19 NavigationError(id: 1, url: '/%2Fadmin%2Fmaintenance%2Fscripts%3D', error: Error: NG04002: Cannot match any routes. URL Segment: '%2Fadmin%2Fmaintenance%2Fscripts%3D') router_module.mjs:1419:19 Object { id: 1, url: "/%2Fadmin%2Fmaintenance%2Fscripts%3D", error: Error, target: undefined, type: 3 }

How to Reproduce?

On an initialized and logged in Angular application with an url like http://localhost:4500/#/admin/maintenance/scripts perform a page reload.

Anything else?

Is this a bug or did I miss to adapt to some behavioural change?

Kind regards

Metadata

Metadata

Labels

help wantedExtra attention is neededkind/bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions