You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When an account logs in, I want the account on other devices to become invalid
** Suggested implementation **
In order to properly support this we would need to add a callback method that is called before the logic in UserAuthentication.signInUser is executed (found here:
And the callback should take the userId, session, and method to be useful. It could also be valuable to allow the callback to modify the scopes passed in. But that could be optional.
When that callback is implemented, you could simply sign out that user from all other devices by calling: await session.messages.authenticationRevoked(userId, RevokedAuthenticationUser());. This would remove any existing authentication keys for the user.
In order to properly support this we would need to add a callback method that is called before the logic in UserAuthentication.signInUser is executed (found here:
And the callback should take the userId, session, and method to be useful. It could also be valuable to allow the callback to modify the scopes passed in. But that could be optional.
When that callback is implemented, you could simply sign out that user from all other devices by calling: await session.messages.authenticationRevoked(userId, RevokedAuthenticationUser());. This would remove any existing authentication keys for the user.
Custom implementation
Yes, simply call await session.messages.authenticationRevoked(userId, RevokedAuthenticationUser()); before creating your authentication token.
Implementation
Is this a feature you would like to request? If so we could update your issue to reflect it?
If you have the capacity, feel free to take a stab at the implementation as well.
In order to properly support this we would need to add a callback method that is called before the logic in UserAuthentication.signInUser is executed (found here:
And the callback should take the userId, session, and method to be useful. It could also be valuable to allow the callback to modify the scopes passed in. But that could be optional.
When that callback is implemented, you could simply sign out that user from all other devices by calling: await session.messages.authenticationRevoked(userId, RevokedAuthenticationUser());. This would remove any existing authentication keys for the user.
Custom implementation
Yes, simply call await session.messages.authenticationRevoked(userId, RevokedAuthenticationUser()); before creating your authentication token.
Implementation
Is this a feature you would like to request? If so we could update your issue to reflect it? If you have the capacity, feel free to take a stab at the implementation as well.
Activity
SandPod commentedon Nov 28, 2024
Hey @git-boya!
For the Serverpod authentication Module
In order to properly support this we would need to add a callback method that is called before the logic in
UserAuthentication.signInUseris executed (found here:serverpod/modules/serverpod_auth/serverpod_auth_server/lib/src/business/user_authentication.dart
Line 16 in 5fcb847
The behavior of the callback method should be configurable through the authentication configuration defined here:
serverpod/modules/serverpod_auth/serverpod_auth_server/lib/src/business/config.dart
Line 177 in 5fcb847
And the callback should take the
userId,session, andmethodto be useful. It could also be valuable to allow the callback to modify the scopes passed in. But that could be optional.When that callback is implemented, you could simply sign out that user from all other devices by calling:
await session.messages.authenticationRevoked(userId, RevokedAuthenticationUser());. This would remove any existing authentication keys for the user.Custom implementation
Yes, simply call
await session.messages.authenticationRevoked(userId, RevokedAuthenticationUser());before creating your authentication token.Implementation
Is this a feature you would like to request? If so we could update your issue to reflect it?
If you have the capacity, feel free to take a stab at the implementation as well.
SandPod commentedon Nov 28, 2024
This is somewhat related to: #1978
git-boya commentedon Nov 28, 2024
Thank! this is what I want.
[-]Can single sign on be implemented now?[/-][+]Support for enforcing single device sign in[/+]