6

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 Answers2

4

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>
0

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}"

  • I also set the Base URL for my client, but when using it with the backToApplication I am redirect to the account page of Keycloak, not to the Base URL – Mike Manders Jan 11 '23 at 14:38