# Limitations

### Some pages still have the default theme. Why?

This project only support out of the box the most common user facing pages of Keycloak login.

To see the complete list of pages that Keycloak provide you can download the base theme with the following command

`npx -p keycloakify download-builtin-keycloak-theme`

[Video demo](https://user-images.githubusercontent.com/6702424/164304458-934b0e1d-9de7-4bb4-8a1c-e06a70b1636a.mov)

[Here](https://github.com/InseeFrLab/keycloakify/tree/main/src/login/pages) are the login pages currently implemented vs [all the existing pages](https://github.com/keycloak/keycloak/tree/main/themes/src/main/resources/theme/base/login).

[Here](https://github.com/InseeFrLab/keycloakify/tree/main/src/account/pages) are the acount pages currently implemented vs [all the existing pages](https://github.com/keycloak/keycloak/tree/main/themes/src/main/resources/theme/base/account).

#### I have established that a page that I need isn't supported out of the box by Keycloakify, now what?

{% tabs %}
{% tab title="I submit a PR to Keycloakify" %}
{% content-ref url="contributing" %}
[contributing](https://docs.keycloakify.dev/keycloakify/v8/contributing)
{% endcontent-ref %}
{% endtab %}

{% tab title="I do it only for my project" %}
Keycloakify also enables you to declare custom ftl pages.

Check out how `my-extra-page-1.ftl` and `my-extra-page-2.ftl` where added to [the demo project](https://github.com/garronej/keycloakify-demo-app/tree/look_and_feel).

Main takeaways are:

* (TS only) You must declare theses page in the type argument of the getter function for the `kcContext` in order to have the correct typings. [example](https://github.com/garronej/keycloakify-demo-app/blob/4eb2a9f63e9823e653b2d439495bda55e5ecc134/src/KcApp/kcContext.ts#L16-L21)
* (TS only) If you use Keycloak plugins that defines non standard `.ftl` values (Like for example [this plugin](https://github.com/micedre/keycloak-mail-whitelisting) that define `authorizedMailDomains` in `register.ftl`) you should declare theses value to get the type. [example](https://github.com/garronej/keycloakify-demo-app/blob/4eb2a9f63e9823e653b2d439495bda55e5ecc134/src/KcApp/kcContext.ts#L6-L13)
* You should provide sample data for all the non standard value if you want to be able to debug the page outside of keycloak. [example](https://github.com/garronej/keycloakify-demo-app/blob/4eb2a9f63e9823e653b2d439495bda55e5ecc134/src/KcApp/kcContext.ts#L28-L43)
  {% endtab %}
  {% endtabs %}

### `process.env.PUBLIC_URL` not supported.

Using `process.env.PUBLIC_URL` is not directly supported (but it will be in the future).\
As a temporary workaround we you can do:

```typescript
import { kcContext as kcLoginThemeContext } from "keycloak-theme/login/kcContext";
import { kcContext as kcAccountThemeContext } from "keycloak-theme/login/kcContext";

const PUBLIC_URL = (()=>{

    const kcContext = (()=>{

        if( kcLoginThemeContext !== undefined ){
            return kcLoginThemeContext;
        }
        
        if( kcAccountThemeContext !== undefined ){
            return kcLoginThemeContext
        }

        return undefined;

    })();

    return (kcContext === undefined || process.env.NODE_ENV === "development")
        ? process.env.PUBLIC_URL
        : `${kcContext.url.resourcesPath}/build`;

})();

// Assuming you have my-image.png in your public directory 
// you can get an URL for it that will be correct regardless of the context with:  
const imageUrl = `${PUBLIC_URL}/my-image.png`;
```

### Self hosted fonts

This scenario **won't** work

{% code title="public/fonts.css" %}

```css
@font-face {
  font-family: Marianne;
  src: url("./fonts/Marianne-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
```

{% endcode %}

{% code title="public/index.html" %}

```html
<link rel="stylesheet" href="%PUBLIC_URL%/font.css" />
```

{% endcode %}

As a workaround you can have your `@font-face` import directly in a style tage of your index.html `<head />`.

{% code title="public/index.html" %}

```diff
-<link rel="stylesheet" href="%PUBLIC_URL%/font.css" />
+<style>
+ @font-face {
+   font-family: Marianne;
+   src: url("%PUBLIC_URL%/fonts/Marianne-Light.woff2") format("woff2");
+   font-weight: 300;
+   font-style: normal;
+   font-display: swap;
+ }
+</style>
```

{% endcode %}

Example [here](https://github.com/garronej/keycloakify-demo-app/blob/9aa2dbaec28a7786d6b2983c9a59d393dec1b2d6/public/index.html#L27-L73) (and the font are [here](https://github.com/garronej/keycloakify-demo-app/tree/main/public/fonts/WorkSans)).

#### Other workarounds

* You can circumvent the problem by avoiding hosting your font yourself using Google Fonts, Font Awesome or any other font provider.
* You can [self host your font somewhere](https://github.com/garronej/keycloakify-demo-app/blob/2de8a9eb6f5de9c94f9cd3991faad0377e63268c/src/fonts.scss#L16), you will need to enable [`Access-Control-Allow-Origin`](https://github.com/garronej/keycloakify-demo-app/blob/2de8a9eb6f5de9c94f9cd3991faad0377e63268c/nginx.conf#L17-L19) on the server serving your fonts.

### Admin Console Theme not supported

<figure><img src="https://3525892426-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPmu3xZyn1RDA1Tdd6NoB%2Fuploads%2Fgit-blob-4f6298d22078f0290bf12a2a3877c002095fbedc%2FAdmin_console_theme_not_supported.png?alt=media" alt=""><figcaption></figcaption></figure>

If you are missing this feature [open an issue about it](https://github.com/InseeFrLab/keycloakify/issues/new).

### Wellcome page not customizable

The following page isn't customizable yet.

<figure><img src="https://3525892426-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPmu3xZyn1RDA1Tdd6NoB%2Fuploads%2Fgit-blob-a99539f44fbe4f52a3dfc06e704e69750e4ebf09%2Fimage%20(10).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

It's however planned to enable this. Follow the progress in [this issue](https://github.com/keycloakify/keycloakify/issues/148).

### Field Names can't be runtime generated

Keycloakify analyze your code to see what field name are used. As a result your field names should be hard coded in your code (If you are [using user profile](https://docs.keycloakify.dev/keycloakify/v8/realtime-input-validation) you don't have to worry about it).

```jsx
// OK ✅
messagesPerField.exists("foo-bar")

// Not OK 🛑
const bar= "bar";
messagesPerField.exists(`foo-${bar}`);
```

{% embed url="<https://cloud-iam.com/?mtm_campaign=keycloakify-deal&mtm_source=keycloakify-doc-limitations>" %}
Feeling overwhelmed? Check out our exclusive sponsor's Cloud IAM consulting services to simplify your experience.
{% endembed %}
