Skip to content

Multi-session

MultiSessionPlugin keeps multiple signed-in identities on one browser or device.

Use the schema, configuration, and store from installation.

use crate::auth_schema::AppAuthSchema;
use better_auth::plugins::MultiSessionPlugin;
use better_auth::sqlx::SqlxStore;
use better_auth::{AuthConfig, AuthResult, BetterAuth};
async fn build_auth(
config: AuthConfig,
store: SqlxStore<AppAuthSchema>,
) -> AuthResult<BetterAuth<AppAuthSchema>> {
BetterAuth::<AppAuthSchema>::new(config)
.store(store)
.plugin(MultiSessionPlugin::new())
.build()
.await
}

The plugin keeps a device’s session collection and exposes /multi-session/list-device-sessions, /multi-session/set-active, and /multi-session/revoke.

This is account switching on one device. To list a user’s sessions across devices, use session management. Configure bounds and behavior with MultiSessionConfig.

See the official Multi-session guide.