Auth Pages
The Auth Pages module provides a comprehensive, secure, and user-friendly authentication system for SwiftUI applications. It leverages multiple authentication providers and methods to ensure a smooth onboarding experience and robust user verification.
Features
This module integrates two powerful authentication boilerplates:
- Firebase Auth
- Supabase Auth
These boilerplates are combined with additional authentication methods to offer a wide range of sign-in options.
Authentication Methods
- 📧 Email/Password: Implemented using both Firebase and Supabase for redundancy and flexibility.
- 📱 Phone Number: Utilizes Twilio verification for secure SMS-based authentication.
- 🍎 Apple Sign-In: Leverages Apple's secure and privacy-focused authentication.
- 🔵 Facebook Login: Integrates Facebook's OAuth for social sign-in.
- 🔴 Google Sign-In: Implements Google's OAuth for quick and easy authentication.
Key Features
- 🔐 Multi-Provider Authentication: Seamlessly integrates multiple auth providers for enhanced reliability.
- 🔄 Password Reset: Robust forgot password functionality with email verification.
- 📝 Form Validation: Implements comprehensive client-side validation for all input fields.
- 🌐 Localization: Full support for multiple languages using SwiftUI's built-in localization.
- ♿ Accessibility: Adheres to WCAG guidelines for maximum usability across all user groups.
- 🎨 Custom UI Components: Utilizes bespoke, reusable UI components for a consistent look and feel.
- 🔄 State Management: Employs ObservableObject pattern for efficient view model state management.
- 🚀 Asynchronous Operations: Leverages Swift's async/await for smooth, non-blocking authentication flows.
- 🔒 Secure Storage: Implements best practices for storing and managing sensitive user data.
- 📊 Analytics Integration: Ready-to-use hooks for integrating authentication events with analytics platforms.
Screenshots
Module Components
The Auth Pages module includes the following key components:
- SignInView: Main entry point for user authentication, offering all available sign-in methods.
- SignUpView: Handles new user registration with email and password.
- SignInEmailView: Dedicated view for email/password authentication.
- PhoneVerificationView: Manages phone number input and SMS code verification.
- ForgotPasswordView: Handles the password reset process.
- SocialAuthButton: Reusable component for social authentication methods.
- AuthViewModel: Core view model managing authentication state and operations.
Implementation Details
- Firebase Integration: Utilizes Firebase SDK for email/password, Google, and Facebook authentication.
- Supabase Integration: Leverages Supabase client for email/password authentication and user management.
- Twilio Verification: Implements custom integration with Twilio API for phone number verification.
- Apple Sign-In: Uses
AuthenticationServices
framework for native Apple authentication. - Social Auth: Implements
OAuth2
flow for Google and Facebook login.
Best Practices
- Implements proper error handling and user feedback for all authentication flows.
- Utilizes secure, asynchronous network calls for all server interactions.
- Follows MVVM architecture for clear separation of concerns and testability.
- Implements proper logout and session management.
Getting Started
To integrate the Auth Pages module into your SwiftUI project:
- Configure Firebase and Supabase projects and add their respective configuration files.
- Set up Twilio account and obtain necessary API credentials.
- Configure social auth providers (Google, Facebook, Apple) in your developer accounts.
- Import the Auth Pages module and initialize with your configuration.
For detailed setup instructions, refer to the documentation in the docs/
directory.
Conclusion
The Auth Pages module offers a robust, flexible, and user-friendly authentication solution for SwiftUI applications. By leveraging multiple providers and authentication methods, it ensures a secure and seamless user experience across various platforms and user preferences.