A React Native application demonstrating OAuth authentication using Supabase and Google Sign-In. This project is built with Expo and TypeScript, providing a robust foundation for mobile authentication.
- 🔐 Google OAuth Authentication
- 📱 Native Google Sign-In on Android
- 🔄 Session Management
- 🎨 Clean and Modern UI
- 🛡️ TypeScript Support
- 📦 Supabase Backend Integration
Before you begin, ensure you have the following installed:
- Node.js (v14 or newer)
- npm or yarn
- Expo CLI (
npm install -g expo-cli) - Android Studio (for Android development)
- Google Cloud Console project with OAuth credentials
- Supabase project
- Create a
.envfile in the root directory with the following variables:
EXPO_PUBLIC_SUPABASE_URL=your_supabase_url
EXPO_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
EXPO_PUBLIC_GOOGLE_WEB_CLIENT_ID=your_google_web_client_id- Clone the repository:
git clone [repository-url]
cd rn-oauth-supabase- Install dependencies:
npm install- Start the development server:
npm startnpm run androidnpm run iosnpm run web/app- Expo Router configuration and main screens/components- React components including authentication UI/lib- Utility functions and Supabase configuration/assets- Static assets like images and fonts
- The app initializes Google Sign-In configuration on startup
- Users can sign in using their Google account
- Upon successful Google authentication, the token is sent to Supabase
- Supabase validates the token and creates/updates the user session
- The app maintains the session using AsyncStorage
@supabase/supabase-js: Supabase JavaScript client@react-native-google-signin/google-signin: Native Google Sign-Inexpo-web-browser: Web authentication handling@react-native-async-storage/async-storage: Session persistenceexpo-router: File-based routing
The application includes comprehensive error handling for:
- Google Sign-In configuration issues
- Authentication failures
- Network errors
- Session management problems
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
-
Google Sign-In Configuration
- Ensure your Google Cloud Console project is properly configured
- Verify the correct Web Client ID in environment variables
- Check that OAuth consent screen is configured
-
Supabase Connection
- Verify Supabase URL and Anon Key in environment variables
- Ensure Supabase project has Google OAuth enabled
- Check CORS configuration in Supabase dashboard
-
Android Build Issues
- Verify Android SDK installation
- Check gradle configuration
- Ensure debug.keystore is properly configured
For more help, please check the issues section or create a new issue.