Sign In

@authon/react-native

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@authon/react-native

Authon React Native SDK — mobile authentication

Source
npmnpm
Version
0.1.21
Version published
Weekly downloads
46
411.11%
Maintainers
1
Weekly downloads
 
Created
Source

@authon/react-native

React Native SDK for Authon — native OAuth, secure token storage, and React hooks.

Install

npm install @authon/react-native
# or
pnpm add @authon/react-native

Requires react-native >= 0.72, expo-auth-session, and expo-secure-store (or bare RN equivalents).

Quick Start

1. Provider

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

export default function App() {
  return (
    <AuthonProvider publishableKey="pk_live_...">
      <Navigation />
    </AuthonProvider>
  );
}

2. Use Hooks

import { useAuthon, useUser } from '@authon/react-native';
import { View, Text, Button } from 'react-native';

function ProfileScreen() {
  const { isSignedIn, signOut } = useAuthon();
  const { user } = useUser();

  if (!isSignedIn) {
    return <SignInScreen />;
  }

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

function SignInScreen() {
  const { signInWithOAuth, signInWithEmail } = useAuthon();

  return (
    <View>
      <Button title="Sign in with Google" onPress={() => signInWithOAuth('google')} />
      <Button title="Sign in with Apple" onPress={() => signInWithOAuth('apple')} />
    </View>
  );
}

API Reference

<AuthonProvider>

<AuthonProvider
  publishableKey="pk_live_..."
  config={{
    apiUrl: 'https://api.authon.dev',
    scheme: 'myapp',  // Custom URL scheme for OAuth redirect
  }}
>

Hooks

useAuthon()

const {
  isSignedIn,       // boolean
  isLoading,        // boolean
  user,             // AuthonUser | null
  signInWithOAuth,  // (provider: string) => Promise<void>
  signInWithEmail,  // (email: string, password: string) => Promise<AuthonUser>
  signOut,          // () => Promise<void>
  getToken,         // () => Promise<string | null>
} = useAuthon();

useUser()

const { user, isLoading } = useUser();

Token Storage

Tokens are stored using expo-secure-store (Expo) or the platform keychain (bare RN), keeping credentials encrypted at rest.

Documentation

authon.dev/docs

License

MIT

Keywords

authon

FAQs

Package last updated on 02 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts