useUser
Access the current authenticated user and account information.
Usage
import { useUser } from '@openfort/react-native';
function Profile() {
const { user, isAuthenticated, getAccessToken } = useUser();
if (!isAuthenticated) return <SignIn />;
return <Text>{user?.player?.name}</Text>;
}Return type
type UseUserReturn = {
user: AuthPlayerResponse | null // Current user object
isAuthenticated: boolean // Whether user is logged in
getAccessToken(): Promise<string | null> // Refresh and get access token
}
type AuthPlayerResponse = {
id: string
object: 'player'
createdAt: number
linkedAccounts: LinkedAccount[]
player?: {
id: string
name: string
metadata?: Record<string, any>
}
}
type LinkedAccount = {
provider: string
email?: string
address?: string
verified?: boolean
disabled: boolean
}