Keycloak v.15.0.0 + React | Invalid parameter : redirect uri


I followed the steps for javascript adapter provide by Keycloak documentation but i’m having a problem. When i try to access to the keycloak login page when i start the application, it’s impossible to display it. If i change my URL route to go to a specific ressource, i have a keycloak page who is trigger but it tells me : Invalid parameter - redirect uri.

I configured the Valid Redirect URIs

I have Nginx in front of Keycloak and i also configured proxy_set_header we pass to Keycloak

proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Am i missing something ?

Any advice or suggestions would be great, thanks!

If you also have https://my-hostname in the field above (root url) you don’t have to specify it again, it won’t work.

Root URL:
Valid Redirects: /test, /api, /files
will translate in valid, etc.

or you can use only * for valid redirects and it will accept any route for

As you know, your application redirects the user to keycloak auth endpoint, which shows user a login form.

After a successful login, keycloak needs to redirect your user back to your application. For security reasons, this should be a pre-approved URL on keycloak.

So, you must pay attention to the correct and exact form of this URL.

Let’s say your applications is accessible via https://my-machine:8443/application, and this is the redirect_uri. You should inform this exact url to keycloak.

You can use wildcards, like https://my-machine:8443/*, and you only need to inform the port if your user needs to include the port in the url to access your application.

It’s possible to see witch redirect_uri your application is trying to use, just inspect the url your browser is showing when the “invalid parameter - redirect uri” is shown by keycloak.

Just take a look on the ```redirect_uri`` parameter. In this case, is:

You can use an online http decoder to get the original url:

Check those URLs and make sure you have this redirect_url in your valid redirect URIs list in keycloak.

1 Like