Access user data securely with Privy identity tokens
linkedAccounts
customMetadata
privy.io
useIdentityToken
hook:custom_metadata
claim of the identity token.
Here’s how to parse and access it:
getAccessToken
when the access token is expiredrefreshUser
from the useUser
hook:getUser
method from @privy-io/server-auth
, which handles verification and parsing:
verifyAuthToken
method will not work on identity tokens, as it is only used to verify Privy
access tokens. Always use getUser({idToken})
when working with identity tokens.getUser
, you can use JWT libraries like jose
:
exp
claim) to ensure the token is still valid