How to configure keycloak-js in a sveltekit application to display a custom login page?

248 Views Asked by At

I am working on a frontend project with Sveltekit, and it's utilizing keycloak-js to communicate with our Keycloak instance.

Currently, I have been tasked with displaying a custom login page instead of the standard Keycloak login page, without adding a theme to Keycloak, as we want to maintain the same colors, spacings, etc. as our designs. I discovered that I can call this endpoint to obtain access and refresh tokens from Keycloak:

POST ${authServerURL}/realms/${authRealm}/protocol/openid-connect/token

Now I am almost convinced that I can build my own authentication mechanism on the frontend, calling this above-mentioned endpoint to get the tokens and store them in the localstorage - refresh them when we need and protect all pages except login.

My question now is, is there a way to configure Keycloak (and keycloak-js) for a custom login page? I haven't been able to find a solution that aligns with the libraries we are currently using.

Thanks in advance!

0

There are 0 best solutions below