SDK

React Native SDK

@authon/react-nativeReact Native SDK with native OAuth flows, secure token storage, and pre-built auth screens.

Installation

bash
npm install @authon/react-native expo-secure-store expo-web-browser
bash
# iOS
npx pod-install

# Expo
npx expo install expo-secure-store expo-web-browser

Setup

App.tsx
import { AuthonProvider } from "@authon/react-native";

export default function App() {
  return (
    <AuthonProvider
      publishableKey="pk_live_your_key"
      // Deep link scheme for OAuth callbacks
      redirectScheme="myapp"
    >
      <Navigation />
    </AuthonProvider>
  );
}

Deep Link Configuration

app.json
{
  "expo": {
    "scheme": "myapp",
    "android": {
      "intentFilters": [
        {
          "action": "VIEW",
          "data": [{ "scheme": "myapp" }],
          "category": ["BROWSABLE", "DEFAULT"]
        }
      ]
    }
  }
}

Usage

screens/HomeScreen.tsx
import { useUser, useAuthon, SignedIn, SignedOut } from "@authon/react-native";
import { View, Text, Button } from "react-native";

export default function HomeScreen() {
  const { user, isLoaded } = useUser();
  const { openSignIn, signOut } = useAuthon();

  if (!isLoaded) return null;

  return (
    <View>
      <SignedIn>
        <Text>Welcome, {user?.displayName}</Text>
        <Button title="Sign out" onPress={signOut} />
      </SignedIn>
      <SignedOut>
        <Button title="Sign in" onPress={() => openSignIn()} />
      </SignedOut>
    </View>
  );
}

OAuth Sign In

tsx
import { useOAuth } from "@authon/react-native";

function GoogleSignIn() {
  const { startOAuth, isLoading } = useOAuth("google");

  return (
    <Button
      title={isLoading ? "Loading..." : "Continue with Google"}
      onPress={startOAuth}
      disabled={isLoading}
    />
  );
}
Token Storage
Tokens are stored using expo-secure-store (iOS Keychain / Android Keystore) for secure encrypted storage.
Authon — Universal Authentication Platform