reauth method
If you are signed in, this is used to perform an authentication check just before changing information for authentication (e.g., email address).
Reauthentication is performed by passing a class inheriting from ReAuthProvider in provider
.
サインインしている場合、認証用の情報(メールアドレスなど)を変更する直前に認証チェックを行うために利用します。
ReAuthProviderを継承したクラスをprovider
で渡すことにより、再認証を行ないます。
Implementation
Future<bool> reauth({
required ReAuthProvider provider,
}) async {
await _initialize();
final account = active;
if (account == null) {
throw Exception(
"You are not signed in. Please sign in with [signIn] first.",
);
}
if (provider is EmailAndPasswordReAuthProvider) {
return account.get(userPasswordKey, "") == provider.password;
} else if (provider is SnsReAuthProvider) {
return activeProviderIds.contains(provider.providerId);
} else {
throw Exception(
"This provider is not supported: ${provider.runtimeType}",
);
}
}