Keycloak Invalid RealmID #640

Open
opened 2025-11-20 05:15:07 -05:00 by saavagebueno · 1 comment
Owner

Originally created by @JonnyBDev on GitHub (Feb 15, 2024).

Describe the problem
We had some trouble setting up Netbird with Keycloak. After some testing we've found out that a RealmID with a space in it will result in Netbird not being able to "warm up cache" and not running as expected at all.

We did not use the RealmID "netbird" as suggested in the docs because our users are stored in the company default Realm "Company GmbH". This will result in an escaped url which looked like this for the admin endpoint:
https://id.customerdomain.tld/admin/realms/company%20gmbh

As I said using this RealmID, we couldn't get Netbird running. Connecting to the UI worked, but it showed a 401 token invalid error message. After renaming the RealmID from "Company GmbH" to "companygmbh", without changing any credentials only the urls, it worked.

To Reproduce

Steps to reproduce the behavior:
Follow the advanced Guide to setup a selfhosted instance with Keycloak.

Expected behavior

Netbird should work with all kinds of RealmIDs

NetBird version
0.25.5

Originally created by @JonnyBDev on GitHub (Feb 15, 2024). **Describe the problem** We had some trouble setting up Netbird with Keycloak. After some testing we've found out that a RealmID with a space in it will result in Netbird not being able to "warm up cache" and not running as expected at all. We did not use the RealmID "netbird" as suggested in the docs because our users are stored in the company default Realm "Company GmbH". This will result in an escaped url which looked like this for the admin endpoint: `https://id.customerdomain.tld/admin/realms/company%20gmbh` As I said using this RealmID, we couldn't get Netbird running. Connecting to the UI worked, but it showed a 401 token invalid error message. After renaming the RealmID from "Company GmbH" to "companygmbh", without changing any credentials only the urls, it worked. **To Reproduce** Steps to reproduce the behavior: Follow the advanced Guide to setup a selfhosted instance with Keycloak. **Expected behavior** Netbird should work with all kinds of RealmIDs **NetBird version** 0.25.5
saavagebueno added the bugtriage-neededkeycloakself-hosting labels 2025-11-20 05:15:08 -05:00
Author
Owner

@surik commented on GitHub (Feb 15, 2024):

Hi @JonnyBDev, we just made a short validation with Keycloak 23. It doesn't allow us to have any special characters in the realm name. See screenshot.

Can you give a bit more information about your setup? Some things that may help:

  1. Keycloack version
  2. Was the realm created on some older version
  3. What do you see if you go to the realm setting and check the URL shown in the browser, eg: http://localhost:8080/admin/master/console/#/test1/realm-settings. Where test1 is the realm name/id.
image
@surik commented on GitHub (Feb 15, 2024): Hi @JonnyBDev, we just made a short validation with Keycloak 23. It doesn't allow us to have any special characters in the realm name. See screenshot. Can you give a bit more information about your setup? Some things that may help: 1. Keycloack version 2. Was the realm created on some older version 3. What do you see if you go to the realm setting and check the URL shown in the browser, eg: `http://localhost:8080/admin/master/console/#/test1/realm-settings`. Where `test1` is the realm name/id. <img width="1208" alt="image" src="https://github.com/netbirdio/netbird/assets/708165/1189debf-437b-423f-9f15-3db0ef1b0754">
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#640