The complete guide to getting started with react-native-auth0 is our Expo QuickStart.
Warning
This SDK is not compatible with "Expo Go" app. It is compatible only with Custom Dev Client and EAS builds.
Clone the repository and install the dependencies with Yarn:
git clone [email protected]:auth0-samples/auth0-react-native-sample.git
cd auth0-react-native-sample/00-login-expo
yarn installOpen the app.json file and locate the following plugin configuration:
"plugins": [
[
"react-native-auth0",
{
"domain": "{DOMAIN}"
}
]
]Replace {DOMAIN} with your Auth0 domain value. If you have samples.auth0.com as your Auth0 domain you would have a configuration like the following:
"plugins": [
[
"react-native-auth0",
{
"domain": "samples.auth0.com"
}
]
]- Copy the
app/auth0-configuration.js.examplein this sample toapp/auth0-configuration.js. - Open your Applications in the Auth0 dashboard.
- Select your existing Application from the list or click Create Application at the top to create a new Application of type Native.
- On the Settings tab for the Application, copy the "Client ID" and "Domain" values and paste them into the
app/auth0-configuration.jsfile created above. - In the Allowed Callback URLs field, paste in the text below and replace
YOUR_DOMAINwith the Domain from above. These URLs are required for the authentication result to be redirected from the browser to the app:
com.auth0samples.auth0://YOUR_DOMAIN/ios/com.auth0samples/callback,
com.auth0samples.auth0://YOUR_DOMAIN/android/com.auth0samples/callback
- Add the same values to the Allowed Logout URLs field as well. These are required for the browser to redirect back to the app after the user logs out.
- Scroll down and click Save Changes.
Run your app on an emulator, simulator, or your own connected device.
- To run the app on iOS run
expo run:ios. - To run the app on Android run
expo run:android.
The first run may take a while to fully launch. Keep an eye out for confirmation windows and watch the terminal for output and results.