Keycloak Invalid Parameter: Redirect_Uri

Keycloak Invalid Parameter: Redirect_Uri

When I am trying to hit from my api to authenticate user from keycloak, but its giving me error Invalid parameter: redirect_uri on keycloak page. I have created my own realm apart from master. keycloak is running on http. Please help me.

6

26 Answers

What worked for me was adding wildchar '*'. Although for production builds, I am going to be more specific with the value of this field. But for dev purposes you can do this.

Setting available under, keycloak admin console -> Realm_Name -> Cients -> Client_Name.

EDIT: DO NOT DO THIS IN PRODUCTION. Doing so creates a large security flaw.

7

If you are a .Net Devloper Please Check below Configurations keycloakAuthentication options class set CallbackPath = RedirectUri,//this Property needs to be set other wise it will show invalid redirecturi error

I faced the same error. In my case, the issue was with Valid Redirect URIs was not correct. So these are the steps I followed.

First login to keycloack as an admin user. Then Select your realm(maybe you will auto-direct to the realm). Then you will see below screen

Select Clients from left panel. Then select relevant client which you configured for your app. By default, you will be Setting tab, if not select it. My app was running on port 3000, so my correct setting is like below. let say you have an app runs on localhost:3000, so your setting should be like this

If you're getting this error because of a new realm you created

You can directly change the URL in the URL bar to get past this error. In the URL that you are redirected to (you may have to look in Chrome dev tools for this URL), change the realm from master to the one you just created, and if you are not using https, then make sure the redirect_uri is also using http.

Robert Thorne
Author

Robert Thorne

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.