useUser
TheuseUser hook provides methods for managing the current user’s profile, email addresses, phone numbers, passwords, and two-factor authentication settings.
Return Value
The current user object
Whether user data is loading
Any error that occurred
refetch
updateProfile
getEmailAddresses
getEmailAddress
createEmailAddress
deleteEmailAddress
prepareEmailVerification
attemptEmailVerification
makeEmailPrimary
createPhoneNumber
deletePhoneNumber
preparePhoneVerification
attemptPhoneVerification
makePhonePrimary
updatePassword
removePassword
deleteAccount
connectSocialAccount
disconnectSocialConnection
getPasskeys
registerPasskey
deletePasskey
renamePasskey
setupAuthenticator
verifyAuthenticator
deleteAuthenticator
generateBackupCodes
regenerateBackupCodes
updateProfilePicture
Profile Management
updateProfile
Update the user’s profile information.New first name
New last name
New username
URL to profile picture
Email Management
createEmailAddress
Add a new email address to the user account.The email address to add
deleteEmailAddress
Remove an email address from the user account.The ID of the email address to remove
prepareEmailVerification
Send a verification code to the specified email address.The ID of the email address to verify
attemptEmailVerification
Verify an email address with an OTP code.The ID of the email address to verify
The OTP verification code
Phone Management
createPhoneNumber
Add a new phone number to the user account.The phone number in E.164 format
The ISO country code (e.g., “US”)
deletePhoneNumber
Remove a phone number from the user account.The ID of the phone number to remove
preparePhoneVerification
Send a verification code to the specified phone number.The ID of the phone number to verify
attemptPhoneVerification
Verify a phone number with an OTP code.The ID of the phone number to verify
The OTP verification code
makePhonePrimary
Set a phone number as the primary phone number for the account.The ID of the phone number to set as primary
makeEmailPrimary
Set an email address as the primary email address for the account.The ID of the email address to set as primary
Password Management
updatePassword
Change the user’s password.The current password
The new password
removePassword
Remove the user’s password. After removal, the user can only sign in with passkeys or OAuth.The current password (required to confirm removal)
deleteAccount
Delete the user’s account permanently.The current password (required to confirm deletion)
Passkey Management
registerPasskey
Register a new passkey for the user using WebAuthn. The name parameter is optional.deletePasskey
Remove a passkey from the user account.The ID of the passkey to remove
renamePasskey
Rename a passkey for easier identification.The ID of the passkey to rename
The new name for the passkey
getPasskeys
Get all passkeys registered to the user account.Profile Picture
updateProfilePicture
Update the user’s profile picture.The image file to upload
Social Connections
connectSocialAccount
Connect a social account (OAuth provider) to the user account.The OAuth provider (e.g., “google_oauth”, “github_oauth”)
Optional redirect URI after OAuth flow
disconnectSocialConnection
Disconnect a social account from the user account.The ID of the social connection to remove
Two-Factor Authentication
setupAuthenticator
Begin TOTP authenticator setup. Returns a QR code URI and secret key.verifyAuthenticator
Complete TOTP setup with verification codes.The authenticator ID
Array of 6-digit TOTP codes
deleteAuthenticator
Remove TOTP authenticator from the user account.generateBackupCodes
Generate backup codes for 2FA recovery.regenerateBackupCodes
Regenerate backup codes (invalidates old ones).Related
- UserButton - User account button
- useSession - Session management
