Skip to content

useGuestAuth

Create guest accounts for instant onboarding without committing to an authentication method.

Usage

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

Return type

type GuestAuthReturn = {
  signUpGuest(options?: GuestOptions): Promise<GuestResult>
  isLoading: boolean
  isError: boolean
  isSuccess: boolean
  error?: OpenfortError | null
}
 
type GuestOptions = {
  onSuccess?: (data: GuestResult) => void
  onError?: (error: OpenfortError) => void
}
 
type GuestResult = {
  user?: AuthPlayerResponse
  error?: OpenfortError
}