Need help creating jar file for custom theme

Good afternoon everyone,

our company has recently switched to Keycloak for our authentication provider (via openid) and we’re setting up the process with which to publish our app, but we’ve encountered an issue.

When we setup our custom login page in the /themes/[themename]/login folder everything works as intended, but if we try and use the .jar file placed in the provider folder we get this error:

2022-10-05 14:51:44,864 ERROR [org.keycloak.headers.DefaultSecurityHeadersProvider] (executor-thread-42) MediaType not set on path /realms/[realm]/protocol/openid-connect/auth, with response status 500
2022-10-05 14:51:44,865 ERROR [io.quarkus.vertx.http.runtime.QuarkusErrorHandler] (executor-thread-42) HTTP Request to /realms/[realm]/protocol/openid-connect/auth?[arguments] failed, error id: 4d5e6f19-0fb6-4577-8402-8d97d273af22-4: org.jboss.resteasy.spi.UnhandledException: javax.ws.rs.InternalServerErrorException: HTTP 500 Internal Server Error

I think we made the jar properly with all the information required in the META-INF folder, so we’re currently stumped. Is there any resource online other than the documentation that could help us understand what we’re doing wrong? or anyone able to help us?

Thanks in advance for any help.

Edit: i forgot to mention we’re using Keycloak v.19.0.1

I had the same problem. The cause was a mismatch in theme name. The theme directory name and the name in keycloak-themes.json must match. If they do not match you will get this error.
The theme directory name:

tree .
├── META-INF
│   └── keycloak-themes.json
└── theme
    └── custom-theme
...

The json “name” key/value

cat META-INF/keycloak-themes.json 
{
  "themes": [
    {
      "name": "custom-theme",
      "types": [
        "admin",
        "account",
        "login"
      ]
    }
  ]