Not able to open keycloak Terms and conditions action before registration

Hii,

I am working on Keycloak theme. Where we need the terms and conditions page before the Registration page.

as per the default setup terms and conditions action getting called after the .registration successful.
as per our project requirement we need the terms and conditions action before Registration page , If user accepts the terms then only able navigate to register otherwise user should be navigated back to login screen.

Is there any workaround to achieve this.

Thanks.

“Terms and Conditions” (Server Administration Guide) in Keycloak is implemented as a RequiredAction, which means it can only be displayed after a login (or successful registration) session. If you want to display your Terms and Conditions before a registration, you’ll have to override the default Registration Authentication flow.

@xgp
Is there any documentation or reference links present which we can use to override the default registration Authentication flow?

Thanks

There is information on how to extend the registration page here:
https://www.keycloak.org/docs/latest/server_development/#modifying-extending-the-registration-form

However, if you want to build the Terms and Conditions as a separate page, you’ll have to build a class that extends FormAuthenticator. See the RegistrationPage class for an example.

@Asperitas Have a look at the first part of my StackOverflow answer. Ran into a similar problem and found a solution that doesn’t require editing .ftl or Java files or shipping your own Docker image. Also shows how to expose the info in tokens to the OAuth2 clients and works with i18n.