For AI agents: a documentation index is available at /llms.txt. A markdown version of this page is available at the same URL with .md appended (or via Accept: text/markdown).
Skip to main content

useIdentityToken

Deprecated

useIdentityToken is deprecated in v10. Use useAuthTokenInfo instead. It returns the same token.

useIdentityToken is a wrapper around useAuthTokenInfo that exposes getAuthTokenInfo under the name getIdentityToken.

Migrate to useAuthTokenInfo​

- import { useIdentityToken } from '@web3auth/react-native-sdk'
+ import { useAuthTokenInfo } from '@web3auth/react-native-sdk'

- const { getIdentityToken, token, loading, error } = useIdentityToken()
- const idToken = await getIdentityToken()
+ const { getAuthTokenInfo, token, loading, error } = useAuthTokenInfo()
+ const idToken = await getAuthTokenInfo()

Return type​

import { type IUseIdentityToken } from '@web3auth/react-native-sdk'

getIdentityToken​

() => Promise<string | null>

Same as getAuthTokenInfo.

token​

string | null

Most recent identity token.

loading​

boolean

true while the token is being fetched.

error​

Web3authRNError | null

Error from the most recent call, or null.