Skip to content

Conversation

@russellwheatley
Copy link
Member

@russellwheatley russellwheatley commented Nov 18, 2025

Key Changes:

  • Removed passwordPrompt and EmailProvider from AuthService - Eliminated internal password prompting logic, delegating UI presentation to the view layer as it should be. Keep UI logic out of the AuthService.
  • Implemented Phone Auth reauthentication, previously it was throwing an error, but now we handle it by throwing the below noted phoneReauthenticationRequired error with phone number which kickstarts phone reauth.
  • Structured Reauthentication Errors - Introduced three specific error types that include actionable context:
emailReauthenticationRequired(context: EmailReauthContext) - includes user's email address
phoneReauthenticationRequired(context: PhoneReauthContext) - includes user's phone number
oauthReauthenticationRequired(context: OAuthReauthContext) - includes provider ID and display name
  • New OAuth Reauthentication Method - Added reauthenticate(context:) that automatically locates registered OAuth providers (Google, Apple, Facebook, Twitter, etc.), obtains fresh credentials, and completes reauthentication without manual credential management.
  • Created another reauthenticate(credential:) for when email/password create a credential for reauth.
  • View-Layer Reauthentication Handling for default Views - Introduced ReauthenticationCoordinator and ReauthenticationModifier to manage reauthentication UI flows declaratively. The coordinator presents appropriate UI (alerts, sheets, password prompts, SMS verification) based on the error context type.
  • Helper Function - Added withReauthenticationIfNeeded() that wraps operations requiring reauthentication, automatically catching reauth errors, presenting UI, and retrying the operation after successful reauthentication.

OAuth provider reauthentication

Simulator.Screen.Recording.-.iPhone.17.Pro.-.2025-11-18.at.16.07.54.mov

Email provider reauthentication

Simulator.Screen.Recording.-.iPhone.17.Pro.-.2025-11-18.at.16.28.24.mov

Phone provider reauthentication

Unfortunately, I hit the phone number sign-in limit so I've taken screenshots of the flow:

Screenshot 2025-11-18 at 12 43 19 Screenshot 2025-11-18 at 12 42 21

@russellwheatley russellwheatley changed the title refactor: add phone auth reauth and move reauth out of authservice refactor: add phone auth reauth and move reauth out of AuthService Nov 18, 2025
@russellwheatley russellwheatley changed the title refactor: add phone auth reauth and move reauth out of AuthService refactor: add phone reauthentication and move reauth UI logic out of AuthService Nov 18, 2025
@russellwheatley russellwheatley marked this pull request as ready for review November 18, 2025 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant