This is Part 3 in the Full-Stack React Native Development with Nhost series. This part creates a production-ready authentication system with secure email verification and proper error handling.
Full-Stack React Native Development with Nhost
1. Create Project
Set up your Nhost project
2. Protected Screens
Screen protection basics
3. User Authentication
Current - Complete auth flow
4. GraphQL Operations
CRUD operations with GraphQL
5. File Uploads
File upload and management
6. Sign in with Apple
Apple authentication integration
Prerequisites
- Complete the Protected Screens part first
- The project from the previous part set up and running
Step-by-Step Guide
1
Create the Sign In Screen
Build a comprehensive sign-in form with proper error handling and loading states. This screen handles user authentication and includes special logic for post-verification sign-in.app/signin.tsx
2
Create the Sign Up Screen
Implement user registration with email verification flow. This screen collects user information, creates accounts, and guides users through the email verification process.app/signup.tsx
3
Create the Email Verification Screen
Build a dedicated verification screen that processes email verification tokens. This screen handles the verification flow when users click the email verification link.app/verify.tsx
Important Configuration Required: Before testing email verification, you must configure your Nhost project’s authentication settings:
- Go to your Nhost project dashboard
- Navigate to Settings → Authentication
- Add your Expo development URL to the Allowed Redirect URLs field:
- For Expo Go:
exp://x.x.x.x:8081/
(replace with your local IP)
- For Expo Go:
- Ensure your production domain is also added when deploying
redirectTo not allowed
error when users attempt to sign up or verify their email addresses.4
Update Home Screen
Update the home screen to include navigation to authentication screens and a button to sign out.app/index.tsx
5
Run and Test the Application
Start your development server and test the complete authentication flow to ensure everything works properly.- Sign Up Flow: Try signing up with a new email address. Check your email for the verification link and click it. See how you are sent to the verification screen and then redirected to your profile.
- Sign In/Out: Try signing out and then signing back in with the same credentials.
- Navigation: Notice how the home screen shows different options based on authentication state - showing “Sign In” and “Sign Up” buttons when logged out, and “Go to Profile” when logged in.
- Error Handling: Try signing in with invalid credentials to see error handling, or try signing up with a short password to see validation.
- Email Verification: Test the complete email verification flow in both development and when deployed.
Key Features Demonstrated
Complete Registration Flow
Complete Registration Flow
Full email/password registration with proper form validation and user feedback optimized for mobile devices.
Email Verification
Email Verification
Custom
/verify
screen that securely processes email verification tokens with Expo Linking integration.Error Handling
Error Handling
Comprehensive error handling for unverified emails, failed authentication, and network issues with mobile-friendly alerts.
Session Management
Session Management
Complete sign out functionality with confirmation dialogs and proper session state management across the application.
React Native Adaptations Made
This tutorial demonstrates several key React Native patterns:- KeyboardAvoidingView: Ensures forms remain accessible when keyboard is open
- ActivityIndicator: Native loading spinners for better performance
- Alert.alert(): Native confirmation dialogs for important actions
- Expo Linking: Proper deep linking for email verification
- TouchableOpacity: Native touch feedback for buttons
- ScrollView: Scrollable content containers with proper keyboard handling