Skip to content

Commit f43a9d8

Browse files
fix: ensure user signs back in to continue with sensitive operation
1 parent 572a693 commit f43a9d8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Services/AuthService.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,11 @@ public extension AuthService {
824824
let password = try await passwordPrompt.confirmPassword()
825825
let credential = EmailAuthProvider.credential(withEmail: email, password: password)
826826
_ = try await user.reauthenticate(with: credential)
827+
} else if providerId == PhoneAuthProviderID {
828+
// Phone auth requires manual reauthentication via sign out and sign in otherwise it will take the user out of the existing flow
829+
throw AuthServiceError.reauthenticationRequired(
830+
"Phone authentication requires you to sign out and sign in again to continue"
831+
)
827832
} else if let matchingProvider = providers.first(where: { $0.id == providerId }),
828833
let credentialProvider = matchingProvider.provider as? CredentialAuthProviderSwift {
829834
let credential = try await credentialProvider.createAuthCredential()

0 commit comments

Comments
 (0)