Skip to main content
Shipnative supports two authentication backends: Supabase and Convex. Both provide email/password auth, social login, and secure session management.

Setup

The wizard prompts for your backend choice and credentials, then configures apps/app/.env automatically. Without credentials: The app runs in mock mode with simulated auth. Connect a real backend before production to test email confirmation, password reset, and OAuth flows.

Using Authentication

The useAuth() Hook

Use useAuth() for all screens and components. It’s the ONLY auth hook you need - it works with both Supabase and Convex backends:
All auth methods work with both backends - no need for provider-specific hooks!

Unified User Object

The AppUser interface normalizes user data across backends:

Common Tasks

  • Supabase: Sends confirmation email, user clicks link to verify
  • Convex: Creates user and logs them in immediately
  • Mock mode: Accounts created instantly without verification
Common errors:
  • Invalid login credentials - wrong email/password
  • Email not confirmed - user needs to verify email first
What gets updated:
  • Supabase: Updates user_metadata in Auth and syncs to profiles table
  • Convex: Updates the users table via mutation
The updateProfile action handles the backend differences automatically. Use firstName/lastName or fullName - it normalizes appropriately for each backend.
See Social Login Guide for provider configuration.

Account Deletion

Apple requires apps to provide account deletion. The Profile screen includes a Delete Account button.
Account deletion calls a Supabase Edge Function:

What Gets Deleted

Optional: GDPR Cleanup

To delete data from third-party services, add secrets to Supabase:

Manual Setup

1. Create Supabase Project

  1. Go to supabase.com/dashboard
  2. Create a new project
  3. Wait for provisioning (~2 minutes)

2. Get Credentials

In Supabase Dashboard → Project SettingsAPI:
  • Copy Project URL (e.g., https://abc123.supabase.co)
  • Copy Publishable key (starts with eyJ)
Never use the service_role key in your app - it bypasses RLS.

3. Configure Environment

Add to apps/app/.env:

4. Run Database Schema

In Supabase Dashboard → SQL Editor, run the contents of supabase/schema.sql. This creates the profiles, user_preferences, and push_tokens tables with RLS policies.See Backend Guide for schema customization.

Security

RLS policies are pre-configured in the schema. auth.uid() returns the current user’s ID.
For more on RLS, see Supabase RLS Documentation.

Direct Client Access

For advanced use cases, access the Supabase client directly:
For full API reference, see Supabase JS Client Docs.

Mock Mode

Without backend credentials, a mock client simulates auth and database operations. Test accounts:
Seed mock data:
See Mock Services for full documentation.

Troubleshooting

Still in mock mode?
  • Verify apps/app/.env exists with correct values
  • Check EXPO_PUBLIC_BACKEND_PROVIDER is set correctly
  • Env vars must start with EXPO_PUBLIC_
  • Restart Metro: yarn start --clear
Database queries fail?
  • Supabase: Check RLS policies in Dashboard
  • Convex: Check function auth guards
  • Verify user is logged in
Email confirmation not arriving?
  • Check spam folder
  • Supabase: Verify email is enabled in Authentication → Settings
  • Convex: Check your Auth.js email provider configuration
CORS errors on web?
  • Supabase: Add http://localhost:19006 to Project Settings → API → Allowed Origins
  • Convex: CORS is handled automatically

Next Steps

Social Login

Add Google, Apple, and other OAuth providers

Database & Backend

Store user data, files, and build backend features

User Preferences

Save app settings per user with Zustand

Push Notifications

Send notifications to authenticated users