Revoke other sessions
The revoke_active_sessions action signs a user out of all their other sessions. The session that triggered the action stays
active. Ory Kratos Identities can run this action after a user:
- Changes their password.
- Recovers their account.
- Signs in.
After a password change
When a user changes their password, the revoke_active_sessions action revokes all other sessions of that user. Anyone who signed
in with the old password loses access. The user stays signed in on the device they used to change the password.
Ory Network turns on this action when you create a project.
- Ory Console
- Ory CLI
- Go to Authentication → Sessions in the Ory Console.
- Toggle Revoke other sessions after password change.
- Click Save.
Run this command to turn on the action:
ory patch identity-config --project <project-id> --workspace <workspace-id> \
--add '/selfservice/flows/settings/after/password/hooks/-={"hook":"revoke_active_sessions"}'
Actions defined for the password method replace the actions defined for all methods of the settings flow. While the
revoke_active_sessions action is set for the password method, webhooks that you defined for all methods of the settings flow
don't run when a user changes their password. Add these webhooks to the password method as well. Read more about
trigger precedence.
After account recovery
When a user recovers their account, the revoke_active_sessions action revokes all other sessions of that user. Anyone who had
access to the account must sign in again.
Ory Network turns on this action when you create a project.
- Ory Console
- Ory CLI
- Go to Authentication → Account recovery in the Ory Console.
- Toggle Revoke other sessions after recovery.
- Click Save.
Run this command to turn on the action:
ory patch identity-config --project <project-id> --workspace <workspace-id> \
--add '/selfservice/flows/recovery/after/hooks/-={"hook":"revoke_active_sessions"}'
After sign-in
When a user signs in, the revoke_active_sessions action signs the user out on all other devices. Each user then has exactly one
active session and device at a time.
Run this command to turn on the action:
ory patch identity-config --project <project-id> --workspace <workspace-id> \
--add '/selfservice/flows/login/after/hooks/-={"hook":"revoke_active_sessions"}'
To run the action for specific sign-in methods, read Revoke previously issued sessions at login.