All of Privy’s login methods result in a unified JSON representation of your user.

To get the current user, inspect the user object returned by the usePrivy hook:

const { user } = usePrivy();

Unauthenticated users

For unauthenticated users, the user object will be null.

Authenticated users

For authenticated users, you can use the following fields:

id
string
required

The Privy-issued DID for the user. If you need to store additional information about a user, you can use this DID to reference them.

createdAt
string
required

The datetime of when the user was created, in ISO 8601 format.

linkedAccounts
array
required

The list of accounts associated with this user. Each account contains additional metadata that may be helpful for advanced use cases.

mfaMethods
array
required

The list of MFA Methods associated with this user.

hasAcceptedTerms
boolean
required

Whether or not the user has explicitly accepted the Terms and Conditions and/or Privacy Policy

isGuest
boolean
required

Whether or not the user is a guest


You can set custom metadata for a user via Privy’s backend server SDK and/or API endpoints.

If a user has not linked an account of a given type, the corresponding field on the user object will be undefined.

Users can have multiple passkeys linked to their account. To find all linked passkeys, use the linkedAccounts list and filter by passkey account type.

Below is an example of how you might use the user object in a minimal user profile:

Example User Profile
import { usePrivy } from "@privy-io/react-auth";

function User() {
const { ready, authenticated, user } = usePrivy();

// Show nothing if user is not authenticated or data is still loading
if (!(ready && authenticated) || !user) {
    return null;
}

return (
    <div>
    <p>User {user.id} has linked the following accounts:</p>
    <ul>
        <li>Apple: {user.apple ? user.apple.email : "None"}</li>
        <li>Discord: {user.discord ? user.discord.username : "None"}</li>
        <li>Email: {user.email ? user.email.address : "None"}</li>
        <li>Farcaster: {user.farcaster ? user.farcaster.username : "None"}</li>
        <li>GitHub: {user.github ? user.github.username : "None"}</li>
        <li>Google: {user.google ? user.google.email : "None"}</li>
        <li>Instagram: {user.instagram ? user.instagram.username : "None"}</li>
        <li>LinkedIn: {user.linkedin ? user.linkedin.email : "None"}</li>
        <li>Phone: {user.phone ? user.phone.number : "None"}</li>
        <li>Spotify: {user.spotify ? user.spotify.email : "None"}</li>
        <li>Telegram: {user.telegram ? user.telegram.username : "None"}</li>
        <li>TikTok: {user.tiktok ? user.tiktok.username : "None"}</li>
        <li>Twitter: {user.twitter ? user.twitter.username : "None"}</li>
        <li>Wallet: {user.wallet ? user.wallet.address : "None"}</li>
    </ul>
    </div>
);
}

Refreshing the user object

In order to update a user object after any type of backend update, (i.e. unlinking an account or setting custom metadata) you can ensure the user object in the application is up-to-date by invoking the refreshUser method from the useUser hook:

Example refresh User
import { useUser } from "@privy-io/react-auth";

const { user, refreshUser } = useUser();

const updateMetadata = async (value: string) => {
// Make API request to update custom metadata for a user from the backend
const response = await updateUserMetadata({ value });
await refreshUser();
// `user` object should be updated
console.log(user);
};