keycloak-angular: redirect_uri parameter is no longer supported in Keycloak v18.0.0

See: https://www.keycloak.org/2022/04/keycloak-1800-released

Bug Report or Feature Request (mark with an x)

- [x] bug report
- [ ] feature request

Versions.

Keycloak v18.0.0 Angular v13.2.0 keycloak-angular: v9.1.0

Repro steps.

After login, call the logout method from the KeycloakService

The log given by the failure.

Invalid parameter: redirect_uri

Desired functionality.

Logout the user.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 47

Most upvoted comments

Any workaround for it?

The documentation of keycloak provides the following workaround: There is a backwards compatibility option, which allows your application to still use the old format of the redirect_uri parameter.

You can enable this parameter when you start the server by entering the following command:

bin/kc.[sh|bat] --spi-login-protocol-openid-connect-legacy-logout-redirect-uri=true start

I fix the problem updating the version of keycloak-js dependency installed by keycloak-angular compatible with Keycloak 18.0.0

When you install keycloak-angular this library install the dependency keycloak-js 16.0.4 in my case, but If you are using keycloak 18.0.0 you must install the version compatible with this service, so update in your package.json the version 16.0.4 to the new 18.0.0 one and execute npm install again.

These are my keycloak dependencies compatible with keycloak 18.0.0

"dependencies": {
    ...
    "keycloak-angular": "^9.1.0",
    "keycloak-js": "^18.0.0",
    ...
    }

Now the logout works correctly. With this version I checked the login, logout and recover user profile and everythin works ok.

If your start keycloak from docker what environent is related to this command spi-login-protocol-openid-connect-legacy-logout-redirect-uri??

Am using the docker image quay.io/keycloak/keycloak:20.0.2 and start --spi-login-protocol-openid-connect-legacy-logout-redirect-uri=true [other parameters] has worked for me. I’m using PHP and my library is https://github.com/stevenmaguire/oauth2-keycloak which has this fixed to redirect_uri (or one of it’s dependencies).

I fix the problem updating the version of keycloak-js dependency installed by keycloak-angular compatible with Keycloak 18.0.0

When you install keycloak-angular this library install the dependency keycloak-js 16.0.4 in my case, but If you are using keycloak 18.0.0 you must install the version compatible with this service, so update in your package.json the version 16.0.4 to the new 18.0.0 one and execute npm install again.

These are my keycloak dependencies compatible with keycloak 18.0.0

"dependencies": {
    ...
    "keycloak-angular": "^9.1.0",
    "keycloak-js": "^18.0.0",
    ...
    }

Now the logout works correctly. With this version I checked the login, logout and recover user profile and everythin works ok.

Thanks @masalinas , it’s working!

@prasannjeet it works, thank you very much for the help, keep it up!!!

Any workaround for it?

The documentation of keycloak provides the following workaround: There is a backwards compatibility option, which allows your application to still use the old format of the redirect_uri parameter.

You can enable this parameter when you start the server by entering the following command:

bin/kc.[sh|bat] --spi-login-protocol-openid-connect-legacy-logout-redirect-uri=true start

Thank you for sharing this! I missed that part ❤️

In the newer version of Keycloak this parameter has been renamed to post_logout_redirect_uri

Please check the documentation: https://www.keycloak.org/docs/latest/securing_apps/index.html#logout

yes I have no problem when I run the application open normally. now that I put it in wamp the problem exists

@giorgosrv

I use keycloak 20.0.3, and

    "keycloak-angular": "^13.0.0",
    "keycloak-js": "^18.0.1",

With these settings, my logout works.

Please restart your keycloak after making the changes in conf file. If it still not works, look into: https://keycloak.discourse.group/t/keycloak-18-legacy-backward-logout-compatibility-option/15918