Next.js
useUserData()
API Documentation
Backend Services
- Authentication
- Storage
GraphQL
- AI
Client Libraries
- JavaScript
- React
- Next.js
- NhostClient
- <SignedIn />
- <SignedOut />
- createServerSideClient()
- getNhostSession()
- useAccessToken()
- useAddSecurityKey()
- useAuthenticated()
- useAuthenticationStatus()
- useChangeEmail()
- useChangePassword()
- useConfigMfa()
- useDecodedAccessToken()
- useFileUpload()
- useFileUploadItem()
- useHasuraClaim()
- useHasuraClaims()
- useMultipleFilesUpload()
- useNhostClient()
- useProviderLink()
- useResetPassword()
- useSendVerificationEmail()
- useSignInAnonymous()
- useSignInEmailPassword()
- useSignInEmailPasswordless()
- useSignInEmailSecurityKey()
- useSignInPAT()
- useSignInSmsPasswordless()
- useSignOut()
- useSignUpEmailPassword()
- useSignUpEmailSecurityKeyEmail()
- useElevateSecurityKeyEmail()
- useUserAvatarUrl()
- useUserData()
- useUserDefaultRole()
- useUserDisplayName()
- useUserEmail()
- useUserId()
- useUserIsAnonymous()
- useUserLocale()
- useUserRoles()
- useSignInEmailOTP()
- useSignInIdToken()
- useLinkIdToken()
- Vue
- React Native
Next.js
useUserData()
Use the hook useUserData
to get the user data of the user.
const userData = useUserData()
Examples
const userData = useUserData()
Example of user data
{
"avatarUrl": "https://s.gravatar.com/avatar",
"createdAt": "2022-04-11T16:33:14.780439+00:00",
"defaultRole": "user",
"displayName": "John Doe",
"email": "john@nhost.io",
"id": "05e054c7-a722-42e7-90a6-3f77a2f118c8",
"isAnonymous": false,
"locale": "en",
"metadata": {
"lastName": "Doe",
"firstName": "John"
},
"roles": ["user", "me"]
}
On this page