0xPass
Search
⌃K
📖

Overview

Managing the current user

Overview

0xPass provides a simple way to authenticate and manage any information tied to the current user.
The useUser hook provides all contextual information on the user:
User object is ONLY created for authenticated or verified users. These are users that Sign In With Ethereum. The user object is null for unauthenticated users.

Usage

Import the useUser into your component
import { useUser } from "0xpass"
Use in the code
const { getUser } = useUser();
const user = await getUser();
You can later access user identities as follows
<p>
User's Object: {JSON.stringify(user)}
</p>

Properties

useUser() returns several usable properties. Below is the exhaustive list:
Example on how to capture a specific property from useUser()
const { getUser, data, error, loading } = useUser();
const user = await getUser();
Property
Usage
Detailed Guide
data
Provides contexual information about user
getUser
Function to be called to fetch user data
error
Has the error in case user object fails to fetch
loading
Boolean (is user fetch completed?)
​