Loading...
Loading...
Use when adding Auth0 login, logout, or session management to an Expo app. Integrates react-native-auth0 with the Expo Config Plugin for native iOS/Android builds — use even if the user says "add login to my Expo app" without mentioning the SDK. Do not use for bare React Native CLI projects.
npx skill4agent add auth0/agent-skills auth0-exporeact-native-auth0auth0-quickstart| Use Case | Recommended Skill |
|---|---|
| Bare React Native CLI project (no Expo) | |
| React web SPA (Vite/CRA) | |
| Next.js application | |
| Vue.js SPA | |
| Angular SPA | |
| Express.js backend | |
| Native Android (Kotlin/Java) | |
| Backend API (JWT validation) | |
Agent instruction: Before installing the Auth0 SDK, check if the project hasinstalled. Read the project'sexpo-dev-clientand look forpackage.jsoninexpo-dev-clientordependencies.devDependencies
Ifis found: Proceed to step 3.expo-dev-client Ifis NOT found: Useexpo-dev-clientwith the following message:AskUserQuestion"TheSDK requires a custom Expo development client — it does not work with Expo Go. Your project does not havereact-native-auth0installed.expo-dev-clientHow would you like to proceed?
- Install it for me — I'll run
and continue setupnpx expo install expo-dev-client- I'll set it up myself — skip this step and continue to Auth0 SDK installation"
If the user picks option 1, run:bashnpx expo install expo-dev-clientThen proceed to step 3. If option 2, proceed to step 3 directly.
npx expo install react-native-auth0app.jsonapp.config.jsbundleIdentifierpackage{
"expo": {
"ios": { "bundleIdentifier": "com.yourcompany.yourapp" },
"android": { "package": "com.yourcompany.yourapp" },
"plugins": [
["react-native-auth0", {
"domain": "YOUR_AUTH0_DOMAIN",
"customScheme": "YOUR_CUSTOM_SCHEME"
}]
]
}
}customSchemeauth0sampleYOUR_CUSTOM_SCHEME://YOUR_AUTH0_DOMAIN/ios/YOUR_BUNDLE_ID/callback,
YOUR_CUSTOM_SCHEME://YOUR_AUTH0_DOMAIN/android/YOUR_PACKAGE/callbackAuth0ProvideruseAuth0Agent instruction: Before adding new UI elements, search the project for existing click handlers for login, logout, sign-in, or sign-out buttons. If existing handlers are found, hook the Auth0 code into them. Only create new buttons if no existing handlers are found.
import React from 'react';
import { Auth0Provider, useAuth0 } from 'react-native-auth0';
import { View, Button, Text, ActivityIndicator } from 'react-native';
function HomeScreen() {
const { authorize, clearSession, user, isLoading, error } = useAuth0();
const login = async () => {
try {
await authorize(
{ scope: 'openid profile email' },
{ customScheme: 'YOUR_CUSTOM_SCHEME' }
);
} catch (e) {
console.error('Login error:', e);
}
};
const logout = async () => {
try {
await clearSession({ customScheme: 'YOUR_CUSTOM_SCHEME' });
} catch (e) {
console.error('Logout error:', e);
}
};
if (isLoading) {
return <ActivityIndicator size="large" />;
}
return (
<View>
{user ? (
<>
<Text>Welcome, {user.name}!</Text>
<Text>{user.email}</Text>
<Button title="Log Out" onPress={logout} />
</>
) : (
<Button title="Log In" onPress={login} />
)}
{error && <Text>{error.message}</Text>}
</View>
);
}
export default function App() {
return (
<Auth0Provider
domain="YOUR_AUTH0_DOMAIN"
clientId="YOUR_AUTH0_CLIENT_ID"
>
<HomeScreen />
</Auth0Provider>
);
}Agent instruction: After completing the integration, build the project to verify it compiles:bashnpx expo prebuild --clean npx expo run:ios # or npx expo run:androidIf the build fails, analyze the error output. Common integration build failures include:
- "Invariant Violation: Native module cannot be null": Using Expo Go instead of a development build — run
ornpx expo run:iosinstead ofnpx expo run:androidnpx expo start- Plugin not applied: Missing
in app.json plugins array — verify the plugin configurationreact-native-auth0- Pod install fails (iOS): Run
to regenerate native projectsnpx expo prebuild --clean- Manifest merge failure (Android): Conflicting auth0Domain placeholder — ensure only the config plugin sets the domain
Re-run the build after each fix. Track the number of build-fix iterations.Failcheck: If the build still fails after 5–6 fix attempts, stop and ask the user using: "The build is still failing after several fix attempts. How would you like to proceed?"AskUserQuestion
- Let the skill continue fixing iteratively
- Fix it manually — show the remaining errors
- Skip build verification — proceed without a successful build
| Mistake | Fix |
|---|---|
| Using Expo Go instead of development build | react-native-auth0 requires native code. Use |
Missing | Pass |
| Callback URL mismatch | Ensure callback URL is all lowercase, no trailing slash, and matches Auth0 Dashboard exactly: |
| App type not set to Native | The Auth0 application must be type Native in the Dashboard, not SPA or Regular Web. |
| Missing bundleIdentifier or package in app.json | Both |
| Forgot to wrap app with Auth0Provider | All components using |
| Using react-native-auth0 v5.x with Expo < 53 | Version 5.x requires Expo 53+. Use v4.x for older Expo versions. |
| Not testing on physical device | Biometric authentication (Face ID, fingerprint) only works on a physical device, not simulators. Always test the full auth flow on a real device before release. |