← 返回 Skills 市场
auth0

Auth0 React Native

作者 Auth0 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
68
总下载
1
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install auth0-react-native
功能描述
Use when adding authentication to React Native or Expo mobile apps (iOS/Android) with biometric support - integrates react-native-auth0 SDK with native deep...
使用说明 (SKILL.md)

Auth0 React Native Integration

Add authentication to React Native and Expo mobile applications using react-native-auth0.


Prerequisites

  • React Native or Expo application
  • Auth0 account and application configured as Native type
  • If you don't have Auth0 set up yet, use the auth0-quickstart skill first

When NOT to Use

  • React web applications - Use auth0-react skill for SPAs (Vite/CRA)
  • React Server Components - Use auth0-nextjs for Next.js applications
  • Non-React native apps - Use platform-specific SDKs (Swift for iOS, Kotlin for Android)
  • Backend APIs - Use JWT validation libraries for your server language

Quick Start Workflow

1. Install SDK

Expo:

npx expo install react-native-auth0

React Native CLI:

npm install react-native-auth0
npx pod-install  # iOS only

2. Configure Environment

For automated setup with Auth0 CLI, see Setup Guide for complete scripts.

For manual setup:

Create .env:

AUTH0_DOMAIN=your-tenant.auth0.com
AUTH0_CLIENT_ID=your-client-id

3. Configure Native Platforms

iOS - Update ios/{YourApp}/Info.plist:

\x3Ckey>CFBundleURLTypes\x3C/key>
\x3Carray>
  \x3Cdict>
    \x3Ckey>CFBundleTypeRole\x3C/key>
    \x3Cstring>None\x3C/string>
    \x3Ckey>CFBundleURLName\x3C/key>
    \x3Cstring>auth0\x3C/string>
    \x3Ckey>CFBundleURLSchemes\x3C/key>
    \x3Carray>
      \x3Cstring>$(PRODUCT_BUNDLE_IDENTIFIER).auth0\x3C/string>
    \x3C/array>
  \x3C/dict>
\x3C/array>

Android - Update android/app/src/main/AndroidManifest.xml:

\x3Cactivity
    android:name="com.auth0.android.provider.RedirectActivity"
    android:exported="true">
    \x3Cintent-filter>
        \x3Caction android:name="android.intent.action.VIEW" />
        \x3Ccategory android:name="android.intent.category.DEFAULT" />
        \x3Ccategory android:name="android.intent.category.BROWSABLE" />
        \x3Cdata
            android:host="YOUR_AUTH0_DOMAIN"
            android:pathPrefix="/android/${applicationId}/callback"
            android:scheme="${applicationId}" />
    \x3C/intent-filter>
\x3C/activity>

Expo - Update app.json:

{
  "expo": {
    "scheme": "your-app-scheme",
    "ios": {
      "bundleIdentifier": "com.yourcompany.yourapp"
    },
    "android": {
      "package": "com.yourcompany.yourapp"
    }
  }
}

4. Add Authentication with Auth0Provider

Wrap your app with Auth0Provider:

import React from 'react';
import { Auth0Provider } from 'react-native-auth0';
import App from './App';

export default function Root() {
  return (
    \x3CAuth0Provider
      domain={process.env.AUTH0_DOMAIN}
      clientId={process.env.AUTH0_CLIENT_ID}
    >
      \x3CApp />
    \x3C/Auth0Provider>
  );
}

5. Use the useAuth0 Hook

import React from 'react';
import { View, Button, Text, ActivityIndicator } from 'react-native';
import { useAuth0 } from 'react-native-auth0';

export default function App() {
  const { user, authorize, clearSession, isLoading } = useAuth0();

  const login = async () => {
    try {
      await authorize({
        scope: 'openid profile email'
      });
    } catch (error) {
      console.error('Login error:', error);
    }
  };

  const logout = async () => {
    try {
      await clearSession();
    } catch (error) {
      console.error('Logout error:', error);
    }
  };

  if (isLoading) {
    return \x3CActivityIndicator />;
  }

  return (
    \x3CView>
      {user ? (
        \x3C>
          \x3CText>Welcome, {user.name}!\x3C/Text>
          \x3CText>{user.email}\x3C/Text>
          \x3CButton title="Logout" onPress={logout} />
        \x3C/>
      ) : (
        \x3CButton title="Login" onPress={login} />
      )}
    \x3C/View>
  );
}

6. Test Authentication

Expo:

npx expo start

React Native:

npx react-native run-ios
# or
npx react-native run-android

Detailed Documentation

  • Setup Guide - Automated setup, native configuration, deep linking
  • Patterns Guide - Secure storage, biometric auth, token refresh
  • API Reference - Complete SDK API, methods, configuration options

Common Mistakes

Mistake Fix
Forgot to wrap app with Auth0Provider All components using useAuth0() must be children of Auth0Provider
Forgot to configure deep linking Add URL scheme to iOS Info.plist and Android AndroidManifest.xml (see Step 3)
Callback URL mismatch Ensure callback URL in Auth0 Dashboard matches your app's URL scheme (e.g., com.yourapp.auth0://YOUR_DOMAIN/ios/com.yourapp/callback)
iOS build fails after install Run npx pod-install to link native dependencies
App created as SPA type in Auth0 Must be Native application type for mobile apps
Not handling auth errors Wrap authorize/clearSession calls in try-catch blocks
Deep link not working on Android Verify android:exported="true" is set on RedirectActivity

Related Skills

  • auth0-quickstart - Basic Auth0 setup
  • auth0-migration - Migrate from another auth provider
  • auth0-mfa - Add Multi-Factor Authentication

Quick Reference

Core Hook API:

  • useAuth0() - Main hook for authentication
  • authorize() - Initiate login
  • clearSession() - Logout
  • user - User profile object
  • getCredentials() - Get tokens for API calls
  • isLoading - Loading state

Common Use Cases:

  • Login/Logout → See Step 5 above
  • Secure token storage → Automatic with Auth0Provider
  • Biometric authentication → Patterns Guide
  • API calls with tokens → Patterns Guide
  • Token refresh → Automatic with getCredentials()

References

安全使用建议
This appears to be a legitimate Auth0 React Native integration guide, but check three things before installing: 1) The skill's metadata declares no required environment variables or binaries, yet the docs instruct creating .env variables (AUTH0_DOMAIN, AUTH0_CLIENT_ID) and use of the Auth0 CLI (auth0 login / auth0 apps create). Confirm where you'll supply those values and whether your platform will surface those env vars to the skill. 2) Ensure you have the Auth0 CLI and expected tooling (npm/npx, CocoaPods) installed locally when following automated steps; the skill does not install them. 3) Treat the client ID and any secrets (if you add client secret later) as sensitive — follow the document's secure-storage guidance and avoid committing .env files to source control. If the platform requires declaring required env vars/binaries, ask the publisher to update the metadata to include AUTH0_DOMAIN, AUTH0_CLIENT_ID and note the optional requirement of the 'auth0' CLI so the permission surface is clear.
功能分析
Type: OpenClaw Skill Name: auth0-react-native Version: 1.0.0 The skill bundle provides legitimate instructions and code snippets for integrating the official Auth0 React Native SDK into mobile applications. It follows standard Auth0 documentation for configuration (Info.plist, AndroidManifest.xml) and implementation (useAuth0 hook), including security best practices like PKCE and secure token storage. No malicious code, data exfiltration, or suspicious commands were found across SKILL.md or the reference files.
能力标签
requires-oauth-tokenrequires-sensitive-credentials
能力评估
Purpose & Capability
The skill's name, description, and instructions consistently describe adding Auth0 auth to React Native/Expo apps using react-native-auth0. However, the SKILL.md and references call out environment variables (AUTH0_DOMAIN, AUTH0_CLIENT_ID) and the Auth0 CLI (auth0 login / auth0 apps create) that are not declared in the skill's required env vars or required binaries in the registry metadata.
Instruction Scope
Runtime instructions stay within the expected scope for integrating Auth0: installing the SDK, editing Info.plist/AndroidManifest.json/app.json, wrapping with Auth0Provider, calling authorize/getCredentials, and testing. There are no instructions to read system files or exfiltrate data to unexpected endpoints. Examples use local .env and common tools like npx/npm/pod-install.
Install Mechanism
This is an instruction-only skill with no install spec and no code files — low install risk. The skill does not instruct downloading arbitrary archives or adding binaries itself.
Credentials
The skill naturally requires Auth0 configuration values (AUTH0_DOMAIN and AUTH0_CLIENT_ID) and demonstrates using them via process.env/.env and the auth0 CLI. Those are expected for the stated purpose, but the metadata lists no required env vars and no required binaries. The mismatch is a proportionality/documentation issue: the requested/used secrets are appropriate, but they should be declared to the platform so users understand what will be needed and where secrets will be entered.
Persistence & Privilege
The skill does not request permanent inclusion (always: false), does not change other skills' configs, and contains no instructions to modify system-wide agent settings. Autonomous invocation is enabled by default but not combined with other high-risk factors here.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install auth0-react-native
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /auth0-react-native 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of auth0-react-native for integrating Auth0 authentication into React Native and Expo mobile apps. - Provides guided setup for both Expo and React Native CLI. - Explains configuration for iOS, Android, and Expo deep linking. - Includes usage examples for Auth0Provider and the useAuth0 hook. - Documents common mistakes and troubleshooting steps. - Links to detailed setup, usage patterns, and API references.
元数据
Slug auth0-react-native
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Auth0 React Native 是什么?

Use when adding authentication to React Native or Expo mobile apps (iOS/Android) with biometric support - integrates react-native-auth0 SDK with native deep... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 68 次。

如何安装 Auth0 React Native?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install auth0-react-native」即可一键安装,无需额外配置。

Auth0 React Native 是免费的吗?

是的,Auth0 React Native 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Auth0 React Native 支持哪些平台?

Auth0 React Native 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Auth0 React Native?

由 Auth0(@auth0)开发并维护,当前版本 v1.0.0。

💬 留言讨论