I’m using Better Auth with Google-only social sign-in and want “single active session per user”: whenever a user signs in, the new session should remain and all other sessions for that user should be revoked.I know this could potentially be done in three places (client after signIn.social, server hooks like hooks.after, or databaseHooks.session.create.after), but I’m not sure which approach is correct/recommended for social login and how to implement it cleanly.
The issues I’ve hit so far:
1. client onSuccess/onResponse fire too early (on button click, before OAuth completes)
2. hooks.after with newSession is null in my setup for social login
3. calling auth.api.revokeOtherSessions from databaseHooks lacks request/headers context, causing problems.