Skip to content

Template for React Native Expo applications with Auth0 setup (Expo Router)

Notifications You must be signed in to change notification settings

fsobh/expo-auth0

Repository files navigation

React Native (Expo) Auth0 Template

Demo of app running

This is an Expo project created with create-expo-app.

This is a starting point for Expo applications that will use Auth0 as its authentication service.

This application uses Expo router

Pre-requisite

  • Setup an Auth0 native Application following this guide

Get started

  1. Install dependencies

    npm install

Setup .env file

EXPO_PUBLIC_AUTHO_AUDIENCE=your-auth0-audience
EXPO_PUBLIC_AUTH0_DOMAIN=dev-example.us.auth0.com
EXPO_PUBLIC_AUTH0_CLIENT_ID=auth0-native-app-client-id
EXPO_PUBLIC_API_URL=https://your-apiurl.com 
Key Value
EXPO_PUBLIC_AUTHO_AUDIENCE Your Auth0 audience
EXPO_PUBLIC_AUTH0_DOMAIN Your Auth0 tenant domain
EXPO_PUBLIC_AUTH0_CLIENT_ID Your Auth0 client ID (native application)
EXPO_PUBLIC_API_URL URL to your back end service (not required)

Make sure to also update your app.json file accordingly with the appropriate values for Auth0 (domain,bundleIdentifier,package)

    "plugins": [
      "expo-router",
      "expo-secure-store",
      [
        "react-native-auth0",
        {
          "domain": "< your-auth0-domain.us.auth0.com >" 
        }
      ],
   ...
   "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.example.io"
   },
   ...
   "android": {
      "adaptiveIcon": {
      "foregroundImage": "./assets/images/splash.png",
      "backgroundColor": "#ffffff"
      },
     "package": "com.example.io"
   }

How to run

  1. Build for Android

    npm run android
  2. Build for ios (Mac only)

    npm run ios

    Executing these commands will generate a native [development build] build for your iOS or Android device/emulator, placing the output in the ./ios or ./android directory, and will automatically run the application.

How to run (Alternative)

Internal Distribution via EAS

  • Use EAS Build for internal distribution
  • Share and install the app on team devices without going through app stores

Both methods ensure secure testing while addressing Auth0's authentication constraints.

About

Template for React Native Expo applications with Auth0 setup (Expo Router)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published