How can I handle failures in RequiredActions (e.g. Terms and conditions?)

I am running Keycloak 22.0.3 and using a custom User SPI. I have enabled external identity providers and put ‘Terms and Conditions’ as a required action.

The problem is that once a user logs in via the external identity provider, the account is created first and the ‘Terms And Conditions’ are presented second.

So how do you handle the case where the ‘Terms and Conditions’ are declined? I want to either delete the account once the terms and conditions are declined, or (even better) do not create the account at all.

Do you have any advice on how to handle this?

Regards

Have you checked to see if there are any events emitted when the T&C’s are declined? If so, your best bet is to write an event listener to do it.