Documentation navigation
← Back to Jupiter Auth

Users

The user object represents a Jupiter Auth user and is returned throughout authentication and user management operations.

PublicUser

This is the user object returned throughout Jupiter Auth.

PropertyTypeDescription
idUserIdUnique identifier for the user.
project_idProjectIdProject that owns the user.
emailstringEmail address associated with the user.
phonestringPhone number associated with the user.
email_verifiedbooleanWhether the email address has been verified.
phone_verifiedbooleanWhether the phone number has been verified.
is_anonymousbooleanWhether the user was created anonymously.
created_atIsoTimestampWhen the user was created.
updated_atIsoTimestampWhen the user was last updated.
last_sign_in_atIsoTimestamp | nullThe most recent successful sign-in time.
providersstring[]Identity providers linked to the user.
identitiesPublicIdentity[]External identities linked to the user.
factorsPublicFactor[]Multi-factor authentication factors enrolled by the user.
user_metadataJsonObjectMetadata controlled by the user or application.
system_attributesJsonObjectMetadata controlled by the authentication system.

Get the authenticated user

getUser validates the session against the Auth server. On server-rendered code, use getUser rather than trusting user data read only from session storage.

const { data, error } = await client.auth.getUser() console.log(data.user)

Validate a supplied access token

Pass an access token to getUser when the token is supplied with the request instead of loaded from the client’s stored session. Jupiter Auth validates it against the server and returns its user.

const { data, error } =  await client.auth.getUser(accessToken)

Update user attributes

updateUser requires an authenticated session. It updates the supplied attributes, stores the returned user in the current session, and emits USER_UPDATED.

const { data, error } = await client.auth.updateUser(  {    email: 'new-address@example.com',    attributes: {      displayName: 'Ada Lovelace'    }  },  {    emailRedirectTo: 'https://app.example.com/auth/callback'  })

Confirm an email or phone change

When an email or phone change requires verification, pass the changed attribute, its new value, and the received code to attributeChangeConfirm.

const { data, error } =  await client.auth.attributeChangeConfirm({    attribute_name: 'email',    email: 'new-address@example.com',    token: confirmationCode  })

Confirm an invitation

inviteConfirm exchanges an invitation code for the invited user and an authenticated session.

const { data, error } =  await client.auth.inviteConfirm({    email: 'invited-user@example.com',    token: invitationCode  })