Authenticator class
A wrapper around Flow that handles the browser-specific parts of authentication.
The constructor takes a Client and a list of scopes. It then creates a Flow and uses it to generate an authentication URI.
The authorize method redirects the browser to the authentication URI.
The logout method redirects the browser to the logout URI.
The credential property returns a Future that completes with a
Credential after the user has signed in and the browser is redirected to
the app. Otherwise, it completes with null
.
The state is not persisted in the browser, so the user will have to sign in again after a page refresh. If you want to persist the state, you'll have to store and restore the credential yourself. You can listen to the Credential.onTokenChanged event to be notified when the credential changes.
Constructors
Properties
-
credential
→ Future<
Credential?> -
A Future that completes with a Credential after the user has signed in
and the browser is redirected to the app. Otherwise, it completes with
null
.final - flow → Flow
-
The Flow used for authentication.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
- Redirects the browser to the authentication URI.
-
logout(
) → void - Redirects the browser to the logout URI.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
trySilentRefresh(
{Duration timeout = const Duration(seconds: 20)}) → Future< Credential> - Tries to refresh the access token silently in a hidden iframe.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited