Home > @firebase/auth > Auth > setPersistence
Auth.setPersistence() method
Changes the type of persistence on the Auth instance.
Signature:
setPersistence(persistence: Persistence): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
persistence | Persistence | The Persistence to use. |
Returns:
Promise<void>
Description
This will affect the currently saved Auth session and applies this type of persistence for future sign-in requests, including sign-in with redirect requests.
This makes it easy for a user signing in to specify whether their session should be remembered or not. It also makes it easier to never persist the Auth state for applications that are shared by other users or have sensitive data.
Example
auth.setPersistence(browserSessionPersistence);