👥
User Metadata
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 { getUser } = useUser();
const user = await getUser();
//you can later access user identities as follows
<p>
User's Object: {JSON.stringify(user)}
</p>
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.
For authenticated users, the following properties and identities can be accessed when they are linked:
user.id
- internal 0xPass ID for the useruser.createdAt
- time of account creationuser.credentials
- list of linked user credentials such as social accounts (google, twitter), email, phone number, etc
{
"id": "540efccf-0206-4c1f-993e-cbce2d1d32a1",
"address": "0x7EdD797805f8Da35A6CC121e2cFC90af542A9249",
"credentials": [
{
"provider": "TWITTER",
"data": {
"twitterId": "3041609574",
"username": "0xkkeon",
"name": "Keon Kim",
"verified": false,
"picture": "https://pbs.twimg.com/profile_images/1590765283727224833/HJPmOT7i_normal.jpg",
"createdAt": "2015-02-25T17:41:08.000Z",
"verifiedType": "none",
"description": "Co-founder @ @0xpass_io | ex-uber",
"followersCount": 1162,
"followingCount": 1278,
"tweetCount": 951,
"listedCount": 33
}
},
{
"provider": "DISCORD",
"data": {
"discordId": "300737730382659595",
"username": "hydra0232",
"avatar": "d459e64a7b304ec4de2cab2c10fc9201",
"picture": "https://cdn.discordapp.com/avatars/300737730382659595/d459e64a7b304ec4de2cab2c10fc9201",
"discriminator": "0",
"locale": "en-US",
"email": "[email protected]",
"verified": true
}
},
{
"provider": "FACEBOOK",
"data": {
"facebookId": "3529443853994480",
"email": null,
"name": "Keon Kim",
"picture": "https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=3529443853994480&height=50&width=50&ext=1689732300&hash=AeQmGnGqjKBUN0H7Hwo"
}
},
{
"provider": "GOOGLE",
"data": {
"googleId": "108629690436716509948",
"email": "[email protected]",
"verifiedEmail": true,
"name": "Keon Kim",
"givenName": "Keon",
"familyName": "Kim",
"picture": "https://lh3.googleusercontent.com/a/AAcHTtfIygQuWPibxRbK1I-zK9hVbcaS__yK3Lxz36U2jVFRS3gK=s96-c",
"locale": "en"
}
}
]
}
Last modified 2mo ago