voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
40 lines (22 loc) • 1.25 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@firebase/auth](./auth.md) > [setPersistence](./auth.setpersistence.md)
## setPersistence() function
Changes the type of persistence on the Auth instance for the currently saved Auth session and applies this type of persistence for future sign-in requests, including sign-in with redirect requests.
<b>Signature:</b>
```typescript
export declare function setPersistence(auth: Auth, persistence: Persistence): Promise<void>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| auth | [Auth](./auth.auth.md) | The Auth instance. |
| persistence | [Persistence](./auth.persistence.md) | The [Persistence](./auth.persistence.md) to use. |
<b>Returns:</b>
Promise<void>
A promise that resolves once the persistence change has completed
## Remarks
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
```javascript
setPersistence(auth, browserSessionPersistence);
```