# Redirecting from Keycloak to discourse with OIDC

**URL:** https://meta.discourse.org/t/redirecting-from-keycloak-to-discourse-with-oidc/212290
**Category:** SSO
**Created:** [December 16, 2021, 9:26am UTC](https://meta.discourse.org/t/redirecting-from-keycloak-to-discourse-with-oidc/212290 "2021-12-16T09:26:16Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Muhammad\_Haris](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/muhammad_haris/32/223396_2.png) [@Muhammad\_Haris](https://meta.discourse.org/u/Muhammad_Haris)
#### Post date: [December 16, 2021, 9:26am UTC](https://meta.discourse.org/t/redirecting-from-keycloak-to-discourse-with-oidc/212290/1 "2021-12-16T09:26:16Z")

</div>

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](http://localhost:3000) and I want it to be [http://localhost:4200](http://localhost:4200). I have configured `Valid Redirect URIs` in keycloak to [http://localhost:4200](http://localhost:4200).

Any hints how can I update the redirect\_uri? Thanks.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [December 16, 2021, 10:28am UTC](https://meta.discourse.org/t/redirecting-from-keycloak-to-discourse-with-oidc/212290/2 "2021-12-16T10:28:21Z")

</div>

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:

```plaintext
d/ember-cli -u

```

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