Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Choose your authentication method

Openfort React Native supports multiple authentication methods. Choose the one that fits your app.

Using Email Authentication

Use useEmailAuth for traditional email/password authentication. Supports sign up, login, password reset, and email verification.

import { useEmailAuth } from "@openfort/react-native"
 
function EmailLogin() {
  const { signInEmail, signUpEmail, isLoading } = useEmailAuth()
 
  const handleSignIn = async () => {
    const result = await signInEmail({
      email: '[email protected]',
      password: 'password123'
    })
    if (result.requiresEmailVerification) {
      // Prompt user to check inbox for verification code
    }
  }
 
  return (
    <Button
      title="Sign In"
      onPress={handleSignIn}
      disabled={isLoading}
    />
  )
}

View full documentation →

Using Email OTP Authentication

Use useEmailAuthOtp for passwordless email authentication. Users receive a one-time password via email.

import { useEmailAuthOtp } from "@openfort/react-native"
 
function EmailOtpLogin() {
  const { requestEmailOtp, signInEmailOtp, isLoading } = useEmailAuthOtp()
 
  const handleRequestOtp = async () => {
    await requestEmailOtp({ email: '[email protected]' })
  }
 
  const handleSignIn = async (otp: string) => {
    await signInEmailOtp({ email: '[email protected]', otp })
  }
 
  return (
    <Button
      title="Send OTP"
      onPress={handleRequestOtp}
      disabled={isLoading}
    />
  )
}

View full documentation →

Using Phone OTP Authentication

Use usePhoneAuthOtp for passwordless phone authentication. Users receive a one-time password via SMS.

import { usePhoneAuthOtp } from "@openfort/react-native"
 
function PhoneOtpLogin() {
  const { requestPhoneOtp, signInPhoneOtp, isLoading } = usePhoneAuthOtp()
 
  const handleRequestOtp = async () => {
    await requestPhoneOtp({ phone: '+1234567890' })
  }
 
  const handleSignIn = async (otp: string) => {
    await signInPhoneOtp({ phone: '+1234567890', otp })
  }
 
  return (
    <Button
      title="Send OTP"
      onPress={handleRequestOtp}
      disabled={isLoading}
    />
  )
}

View full documentation →

Using Social Authentication

Use useOAuth for social login (Google, Facebook, Twitter, Apple) and account linking.

import { OAuthProvider, useOAuth } from "@openfort/react-native"
 
function SocialLogin() {
  const { initOAuth, isLoading } = useOAuth()
 
  const loginWithGoogle = () => initOAuth({ provider: OAuthProvider.GOOGLE })
 
  return (
    <Button
      title="Sign in with Google"
      onPress={loginWithGoogle}
      disabled={isLoading}
    />
  )
}

View full documentation →

Using Wallet Authentication

Use useWalletAuth to connect external wallets (MetaMask, WalletConnect, and others) with SIWE.

import { useWalletAuth } from "@openfort/react-native"
 
function WalletLogin({ walletAddress }: { walletAddress: string }) {
  const { generateSiweMessage, signInWithSiwe, isLoading } = useWalletAuth()
 
  const startLogin = async () => {
    const { message } = await generateSiweMessage({
      wallet: walletAddress,
      from: { domain: 'example.com', uri: 'https://example.com' },
    })
    if (!message) return
    const signature = await signMessageWithWallet(message)
    await signInWithSiwe({ walletAddress, signature, messageOverride: message })
  }
 
  return (
    <Button
      title="Connect Wallet"
      onPress={startLogin}
      disabled={isLoading}
    />
  )
}

View full documentation →

Using Guest Authentication

Use useGuestAuth for anonymous users and instant onboarding.

import { useGuestAuth } from "@openfort/react-native"
 
function GuestLogin() {
  const { signUpGuest, isLoading } = useGuestAuth()
 
  return (
    <Button
      title="Try as guest"
      onPress={() => signUpGuest()}
      disabled={isLoading}
    />
  )
}

View full documentation →

Using Your Own Authentication

Openfort supports integrating with external authentication providers like Firebase, Supabase, Auth0, and custom auth systems. This allows you to use your existing authentication while creating embedded wallets for users.

View full documentation →

Copyright © 2023-present Alamas Labs, Inc