How to get direct link of realm for the pop up log in page of keycloack

I have two services that support ouath that are set up using keycloack , they are under the same realm .

I have one html page with 2 buttons for each website called mainpage.

Now i want to create a login page that just has a button a user press and the log in page of keycloack comes then after he fills his info he gets redirected to mainpage and he is already logged in to my other 2 services.

How can i achieve that ? Is there any way to get the url the log in pop up page directly for the realm on a simple html page?

If you are importing the keycloak-js library in your HTML page, you can call createLoginUrl once the library is initialized to get the URL for the Keycloak login page. More docs here: Securing Applications and Services Guide

Thank you so much for the reply .
Got another question.

Site build using java servlets running on tomcat .
If i want to directly get the url for the pop up of the keycloak log in page , how do i do it ?
Also where in my application will i insert the realm settings(token,auth,userinfo etc), or i dont have to do that ?

What i want to achieve is having a button on my homepage
then after they fill in their info get redirected to homepage . In the homepage there are 2 buttons for two different sites that already work with keycloak.

And to get redirected to the homepage do i just fill in the redirect url to keycloak client page?

Thank you so much.

There is good documentation on how to set up the client configuration for Java here:

And there are adapters you can use for Tomcat:

And securing servlets: