Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c1d54e1
refactor: add phone auth reauth and move reauth out of authservice
russellwheatley Nov 18, 2025
c6a2d3c
fix: linkaccounts reauth
russellwheatley Nov 18, 2025
6654f66
chore: reorder attributes
russellwheatley Nov 18, 2025
4c8d8b8
us preconcurrency for User which is non-sendable
russellwheatley Nov 18, 2025
0d90729
chore: fix the authenticated user, if no display name, likely use pho…
russellwheatley Nov 18, 2025
0cb634d
fix: user requests sms in PhoneReauthView
russellwheatley Nov 18, 2025
3e3ec72
chore: fix up UI for consistency
russellwheatley Nov 18, 2025
1306c7b
chore: ui updates
russellwheatley Nov 18, 2025
7511d9c
refactor: authenticate() methods for different providers
russellwheatley Nov 18, 2025
2504703
refactor: reuse coordinator for email/phone
russellwheatley Nov 18, 2025
27f3a61
format
russellwheatley Nov 18, 2025
13b93d2
refactor: rename to match PhoneReauthView
russellwheatley Nov 18, 2025
9ef04f9
refactor: reauth helpers
russellwheatley Nov 18, 2025
1ffa862
chore: implement displayName for friendly provider messages
russellwheatley Nov 18, 2025
c6c135e
fix: add LINE label
russellwheatley Nov 18, 2025
9c5898f
fix: ensure error is thrown if not reauth error
russellwheatley Nov 18, 2025
2819e30
format
russellwheatley Nov 18, 2025
e749e11
refactor: ensure authenticate() method is for OAuth only
russellwheatley Nov 18, 2025
8ba46b2
docs: readme
russellwheatley Nov 18, 2025
6e0e490
test: fix test app
russellwheatley Nov 18, 2025
7725367
docs: update documentation
russellwheatley Nov 18, 2025
38c652a
chore: clean up AuthService private/public members
russellwheatley Nov 19, 2025
5e79e5e
chore: format
russellwheatley Nov 19, 2025
49a451a
test: swift linter and format scripts
russellwheatley Nov 19, 2025
fd7ea41
format
russellwheatley Nov 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public class AppleProviderAuthUI: AuthProviderUI {
private let typedProvider: AppleProviderSwift
public var provider: AuthProviderSwift { typedProvider }
public let id: String = "apple.com"
public let displayName: String = "Apple"

public init(provider: AppleProviderSwift) {
typedProvider = provider
Expand Down
79 changes: 76 additions & 3 deletions FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/AuthServiceError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,65 @@
import FirebaseAuth
import SwiftUI

/// Context information for OAuth provider reauthentication (Google, Apple, Facebook, Twitter, etc.)
public struct OAuthReauthContext: Equatable {
public let providerId: String
public let providerName: String

public init(providerId: String, providerName: String) {
self.providerId = providerId
self.providerName = providerName
}

public var displayMessage: String {
"Please sign in with \(providerName) to continue"
}
}

/// Context information for email/password reauthentication
public struct EmailReauthContext: Equatable {
public let email: String

public init(email: String) {
self.email = email
}

public var displayMessage: String {
"Please enter your password to continue"
}
}

/// Context information for phone number reauthentication
public struct PhoneReauthContext: Equatable {
public let phoneNumber: String

public init(phoneNumber: String) {
self.phoneNumber = phoneNumber
}

public var displayMessage: String {
"Please verify your phone number to continue"
}
}

/// Type-safe wrapper for reauthentication contexts
public enum ReauthenticationType: Equatable {
case oauth(OAuthReauthContext)
case email(EmailReauthContext)
case phone(PhoneReauthContext)

public var displayMessage: String {
switch self {
case let .oauth(context):
return context.displayMessage
case let .email(context):
return context.displayMessage
case let .phone(context):
return context.displayMessage
}
}
}

/// Describes the specific type of account conflict that occurred
public enum AccountConflictType: Equatable {
/// Account exists with a different provider (e.g., user signed up with Google, trying to use
Expand Down Expand Up @@ -72,7 +131,17 @@ public enum AuthServiceError: LocalizedError {
case invalidEmailLink(String)
case clientIdNotFound(String)
case notConfiguredActionCodeSettings(String)
case reauthenticationRequired(String)

/// OAuth reauthentication required (Google, Apple, Facebook, Twitter, etc.)
/// Can be passed directly to `reauthenticate(context:)` method
case oauthReauthenticationRequired(context: OAuthReauthContext)

/// Email reauthentication required - user must handle password prompt externally
case emailReauthenticationRequired(context: EmailReauthContext)

/// Phone reauthentication required - user must handle SMS verification flow externally
case phoneReauthenticationRequired(context: PhoneReauthContext)

case invalidCredentials(String)
case signInFailed(underlying: Error)
case accountConflict(AccountConflictContext)
Expand All @@ -92,8 +161,12 @@ public enum AuthServiceError: LocalizedError {
return description
case let .notConfiguredActionCodeSettings(description):
return description
case let .reauthenticationRequired(description):
return description
case let .oauthReauthenticationRequired(context):
return "Please sign in again with \(context.providerName) to continue"
case .emailReauthenticationRequired:
return "Please enter your password to continue"
case .phoneReauthenticationRequired:
return "Please verify your phone number to continue"
case let .invalidCredentials(description):
return description
// Use when failed to sign-in with Firebase
Expand Down

This file was deleted.

Loading
Loading