Anonymous
AnonymousPlugin creates a temporary user identity before full account registration.
Generate the plugin schema and apply it with your application migrations:
better-auth-rs generate --plugins anonymous -o src/auth_schema.rsUse the schema, configuration, and store from installation.
use crate::auth_schema::AppAuthSchema;use better_auth::plugins::AnonymousPlugin;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(AnonymousPlugin::new()) .build() .await}Endpoints and options
Section titled “Endpoints and options”Start with POST /sign-in/anonymous. Configure linking through AnonymousConfig and the LinkAnonymousAccount callback to transfer application-owned data when the visitor adopts a permanent identity. POST /delete-anonymous-user supports removal of the anonymous account.
The user’s anonymous state is part of the identity lifecycle; decide what temporary users can access in application authorization.
Frontend
Section titled “Frontend”See the official Anonymous guide.