Group membership lifespan

I would like to setup a lifespan of membership in the group for specific user.

It will be great to have a possibility to set a datetime after expiration of which user is leaved a group automatically.

How Can I do it?

This is not possible in Keycloak natively.

You could run a scheduled job outside of Keycloak and just call the remove membership method on the Keycloak Admin API Keycloak Admin REST API