Keycloack does not recognize my themes

Can you provide a reference what file structure should be here?

Fix custom themes issue by creating custom named theme folder different from openremote name and existing ones from Keycloack.

Call a custom theme master inside my custom folder and from the ui load it

But now I get another problem in the system.

POST https://myiot.es/api/master/console/register 400 (Bad Request)
Uncaught (in promise) Error: Request failed with status code 400

any idea? :joy: It looks like an authentication problem

Thank you very much for your help

https://www.keycloak.org/docs/latest/server_development/#_themes

Firstly can you post the log of the manager container just after that 400 error occurs whilst loading the Manager UI (it will help improve robustness of console registration).

Then can you try in a cognito window or clear your browsers local storage and see if it works then.

Good morning from Spain, @Rich @michal

This is the error that is repeated, could it be something from the keycloack configuration?

I try to search and solve but there is no way at the moment

I think that the key is here “Failed to get tenant for realm: master”

If you have any ideas, you would help me a lot

Caused by: java.lang.RuntimeException: OAuth server response error: 401
manager_1     |         at org.openremote.container.web.OAuthFilter.updateToken(OAuthFilter.java:108)
manager_1     |         at org.openremote.container.web.OAuthFilter.getAccessToken(OAuthFilter.java:77)
manager_1     |         at org.openremote.container.web.OAuthFilter.getAuthHeader(OAuthFilter.java:63)
manager_1     |         at org.openremote.container.web.OAuthFilter.filter(OAuthFilter.java:152)
manager_1     |         at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.filterRequest(ClientInvocation.java:583)
manager_1     | 2021-05-26 08:06:01.125  WARNING [WebService task-2             ] emote.container.web.OAuthFilter.PROTOCOL : OAuth server response error: 401
manager_1     | 2021-05-26 08:06:01.126  INFO    [WebService task-2             ] security.ManagerKeycloakIdentityProvider : Failed to get tenant for realm: master

Thank you so much

Good morning,

Looks to me like the manager cannot communicate with keycloak which likely means you’ve changed the SETUP_ADMIN_PASSWORD without doing a clean install (keycloak only sets the admin password if the user doesn’t already exist in the database).

  • Take the stack down (docker-compose…down)
  • docker volume prune
  • Start the stack again (docker-compose…up)

Just a remark. Your server address is open to interent and you are now deploying using default password, which everybody knows. When you used or deploy --dnsname a secure password was generated. Probably you can reuse this password if you haven’t nuke your database yet. If you don’t remember the generated password just look inside ~/.openremote/config.ini, it should be there. In any case don’t use the default password on the internet. Everyone can hack your site with it.

Hello @michal @Rich

In the end I was able to solve the problems starting from 0 and customize my keycloack and manager theme

Thank you very much for your help :slight_smile:

2 Likes

Hi @alvaro.heras ,

I have followed this thread and am happy you have solved your issues.

Would you be generous enough to give a step by step on how to do this as I can’t find
any guide on custom keycloack themes

Thanks,
kieran

You can volume map custom themes into the /deployment/keycloak/themes directory of the keycloak container and you can then set that theme name either programmatically or by logging into the keycloak admin console https://orhostname/auth and selecting the realm and then you can set the theme in the realm settings.

Refer to keycloak docs for creating themes.

1 Like