Hey Julien -
We have an admin API endpoint that lets you revoke sessions that does this that you can access from a function. There is a previous post on the forum that goes into detail about how to use the Admin API within functions here that might help.