Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keycloak - direct user link registration

I have set up a web application with Keycloak in my local machine. Since Im using Keycloak as SSO implementation, I want in my web app that whenever SIGNUP button is click, user is directed into the registration page, and not going through the LOGIN page.

This is the example URL directed to the registration form, however, it contains a tab_id that is generated randomly like a session id.

https://site.test/auth/realms/custom/login-actions/authenticate?client_id=test&tab_id=qIdW92Bvwmk

I read about this link

Yes, as long as you use the "registrations" instead of "auth" in the end of login ( AuthorizationEndpoint ) URL

But my endpoint in https://site.test/auth/realms/custom/.well-known/openid-configuration cannot be modified.

like image 710
johntanquinco Avatar asked Jul 25 '18 08:07

johntanquinco


2 Answers

You can change the button link to this format -

http://<domain.com>/auth/realms/<realm-name>/protocol/openid-connect/registrations?client_id=<client_id>&response_type=code&scope=openid email&redirect_uri=http://<domain.com>/<redirect-path>&kc_locale=<two-digit-lang-code>
like image 130
Sundararajan KS Avatar answered Nov 14 '22 19:11

Sundararajan KS


The registration page is exposed via an openid-connect endpoint, accessible in the same way as the standard auth screen. To construct the correct URL you can simply replace openid-connect/auth in the URL with openid-connect/registrations from the .well-known auth endpoint.

    authEndpoint.replace("openid-connect/auth","openid-connect/registrations");

Using this endpoint the user will be directed to the registration screen instead of the login screen.

It is not documented or exposed via .well-known/openid-configuration, but you can see it in the source code:

    public static UriBuilder registrationsUrl(UriBuilder baseUriBuilder) {
        UriBuilder uriBuilder = tokenServiceBaseUrl(baseUriBuilder);
        return uriBuilder.path(OIDCLoginProtocolService.class, "registrations");
    }
like image 1
alan irwin godinez ramirez Avatar answered Nov 14 '22 20:11

alan irwin godinez ramirez