Keycloak - How to add Back to app link on login page

Viewed 2359

I would like to know how to add a Back to App link on the keycloak login page. I'm using a react front end, and when i use the method keycloak.login() i'm going to my keycloak server. And here i want to add the possibility to go back to my app on the redirectUri sent by the keycloak login method.

I don't find any options in the realm management, and i have created a custom theme and i don't get the name of the properties to acces to the redirectUri link.

Thank's Arthur

2 Answers

in the login/template.ftl file you have access to a client variable. This variable is an instance of ClientBean. This bean exposes a variable baseUrl, which you can use to link to your client application.

For Example:

<a href=${client.baseUrl} class="block">${kcSanitize(msg("loginTitleHtml",(realm.displayNameHtml!'')))?no_esc}</a>

In my case I wanted to use my app's sign up page via a link in keycloak login page.

What I did was I set my app base url in "Base url" in my client settings. And then I was able to access it from login.ftl using "${client.baseUrl}"

Related