Authentication class
Authentication implemented by AuthAdapter.
register to register the user, and signIn to sign in.
Depending on the AuthProvider, it may be necessary to confirm the sign-in by doing confirmSignIn after executing signIn. You must also confirm your registration by verify.
If you restart the app after registering and signing in, please execute tryRestoreAuth when the app starts in order to re-authenticate.
You can reset your password by doing reset.
When changing authentication information, after reconfirming the authentication information with reauth (not necessary depending on the AuthProvider), the information can be changed with change. Then, depending on the AuthProvider, confirmChange must be executed to confirm the change.
You can sign out with signOut and delete authentication with delete.
It is possible to change the authentication platform used by specifying adapter.
You can log authentication events by specifying loggerAdapters.
AuthAdapterで実装された認証を行います。
registerでユーザーの登録を行ない、signInでサインインを行ないます。
AuthProviderによってはsignIn実行後、confirmSignInを行うことでサインインを確定する必要があります。 またverifyによって登録を確定させる必要があります。
登録、サインイン後にアプリを再起動した場合、再認証を行うためにアプリ起動時にtryRestoreAuthを実行してください。
resetを行うことでパスワードをリセットすることが可能です。
認証情報を変更する際、reauthで認証情報を再確認した後(AuthProviderによっては必要ありません)changeで情報を変更することが可能です。 その後、AuthProviderによってはconfirmChangeを実行して変更を確定させる必要があります。
signOutでサインアウトし、deleteで認証を削除することができます。
adapterを指定することで利用する認証プラットフォームを変更することが可能です。
loggerAdaptersを指定することによって認証イベントのログを取得することができます。
- Inheritance
-
- Object
- ChangeNotifier
- Authentication
- Available Extensions
Constructors
-
Authentication({AuthAdapter? adapter, List<
LoggerAdapter> loggerAdapters = const []}) - Authentication implemented by AuthAdapter.
Properties
-
accessToken
→ Future<
String?> -
Returns the access token used during sign-in and authentication.
no setter
-
activeProviderIds
→ List<
String> ? -
Returns a list of authenticated provider IDs upon sign-in.
no setter
- adapter → AuthAdapter
-
An adapter that defines the authentication platform.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isAnonymously → bool
-
Returns
true
in case of anonymous or guest authentication.no setter - isSignedIn → bool
-
If you are signed in,
true
is returned.no setter - isVerified → bool
-
Returns
true
if the registration has been authenticated.no setter - isWaitingConfirmation → bool
-
Returns
true
if confirmSignIn or confirmChange is required.no setter -
loggerAdapters
→ List<
LoggerAdapter> -
Adapter to define loggers.
no setter
- refreshToken → String?
-
Returns a refresh token used during sign-in and authentication.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- userEmail → String?
-
Returns the email address registered with the authentication platform upon sign-in.
no setter
- userId → String?
-
Returns the user ID on the authentication platform during sign-in.
no setter
- userName → String?
-
Returns the user name on the authentication platform during sign-in.
no setter
- userPhoneNumber → String?
-
Returns the phone number registered with the authentication platform upon sign-in.
no setter
- userPhotoURL → String?
-
Returns the URL of the user's icon registered on the authentication platform during sign-in.
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
change(
ChangeAuthProvider provider) → Future< Authentication> - Used to change the registered information.
-
confirmChange(
ConfirmChangeAuthProvider provider) → Future< Authentication> - If you change with ChangePhoneNumberAuthProvider, for example, you need to check the authentication code you received from an email or SMS. In that case, use this method to finalize the change.
-
confirmSignIn(
ConfirmSignInAuthProvider provider) → Future< Authentication> - If you signIn with EmailLinkSignInAuthProvider or SmsSignInAuthProvider, you need to check the authentication code received from email or SMS. In that case, use this method to finalize the sign-in.
-
create(
CreateAuthProvider provider) → Future< String?> -
Register users by passing a class inheriting from CreateAuthProvider in
provider
. -
delete(
) → Future< Authentication> - Deletes already registered users.
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
reauth(
ReAuthProvider provider) → Future< Authentication> - If you are signed in, this is used to perform an authentication check just before changing information for authentication (e.g., email address).
-
refresh(
) → Future< Authentication> - This is used to update the authentication status after executing verify, for example.
-
register(
RegisterAuthProvider provider) → Future< Authentication> -
Register a user by passing a class inheriting from RegisterAuthProvider in
provider
. -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
reset(
ResetAuthProvider provider) → Future< Authentication> - Used to reset the password.
-
signIn(
SignInAuthProvider provider) → Future< Authentication> -
Sign-in is performed by passing a class inheriting from SignInAuthProvider as
provider
. -
signOut(
) → Future< Authentication> - Sign out if you are already signed in.
-
toString(
) → String -
A string representation of this object.
inherited
-
tryRestoreAuth(
{bool retryWhenTimeout = false}) → Future< Authentication> - Running the application at startup will automatically re-authenticate the user.
-
verify(
VerifyAuthProvider provider) → Future< Authentication> - Used to prove possession of the e-mail address.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
registerAuthAction(
AuthAction action) → void -
Special callbacks can be registered as AuthAction by passing AuthAction to
action
. -
unregisterAuthAction(
AuthAction action) → void -
You can cancel an already registered AuthAction by passing AuthAction to
action
.