setPersistence method

Future setPersistence(
  1. String persistence
)

Changes the current type of persistence on the current 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. This will return a Future that will resolve once the state finishes copying from one type of storage to the other. Calling a sign-in method after changing persistence will wait for that persistence change to complete before applying it on the new Auth state.

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.

The default is 'local' (provided the browser supports this mechanism).

The persistence string is the auth state persistence mechanism. See allowed persistence values in Persistence class.

Implementation

Future setPersistence(String persistence) =>
    handleThenable(jsObject.setPersistence(persistence));