Manage User Entity

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:

import { useUser } from "0xpass"
 
// in your code...
const { user } = useUser()
 
//you can later access user identities as follows
<p> User's Twitter Username: {user.twitter.screen_name} </p>

Note:
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.

Properties

For authenticated users, the following properties and identities can be accessed when they are linked:

  • user.id - internal 0xPass ID for the user
  • user.createdAt - time of account creation
  • user.wallets - list of user's wallets
  • user.google - user's Google account details
  • user.twitter - user's Twitter account details
  • user.farcaster - user's Farcaster account details
  • Support for additional identities such as phone, email, github, twitch, discord, etc are being added

To view all the accounts and identities currently linked to a user, you can use user.identities. For example, that could represent a list as follows:

  • user.identities: ["google", "farcaster"]

User Object (Example)

{
  "id": "63ef6587-88de-4678-933e-a924c6746640",
  "createdAt": "2023-03-19T23:19:42.564Z",
  "identities": ["twitter", "github"],
  "twitter": {
    "description": "Co-founder @ Om Labs (@0xpass_io) | ex-uber",
    "name": "Keon Kim",
    "nickname": "Keon Kim",
    "picture": "https://pbs.twimg.com/profile_images/1590765283727224833/HJPmOT7i_normal.jpg",
    "screen_name": "0xkkeon"
  },
  "github": {
    "bio": "Co-founder @ 0xPass,\r\nex-Uber",
    "email": "[email protected]",
    "location": "San Francisco",
    "name": "Keon",
    "nickname": "keon",
    "picture": "https://avatars.githubusercontent.com/u/10793962?v=4",
    "email_verified": true
  }
}