Redirecting from Keycloak to discourse with OIDC

I have integrated Keycloak with Discourse with OIDC but on localhost. I have integrated ODIC Discourse plugin. The discourse is working on localhost:4200 and the d/rails is up on localhost:3000. When I am trying to login with OIDC its redirecting url (redirect_uri) is set to http://localhost:3000 and I want it to be http://localhost:4200. I have configured Valid Redirect URIs in keycloak to http://localhost:4200.

Any hints how can I update the redirect_uri? Thanks.

1 Like

To fix this, you’ll need to tell the rails server which port to use for redirects/links/etc. Normally, you’d do that by running something like DISCOURSE_PORT=4300 bin/rails.

However, since you’re using the d/ docker helpers, I’m not sure if that environment variables are passed through.

The easiest solution here is probably to use our built-in method for running a rails server alongside Ember CLI. Stop any existing rails/ember-cli instances, and then run:

d/ember-cli -u

It should start up Ember-CLI, and a properly configured Rails server.

1 Like