PublicUser
This is the user object returned throughout Jupiter Auth.
| Property | Type | Description |
|---|---|---|
| id | UserId | Unique identifier for the user. |
| project_id | ProjectId | Project that owns the user. |
| string | Email address associated with the user. | |
| phone | string | Phone number associated with the user. |
| email_verified | boolean | Whether the email address has been verified. |
| phone_verified | boolean | Whether the phone number has been verified. |
| is_anonymous | boolean | Whether the user was created anonymously. |
| created_at | IsoTimestamp | When the user was created. |
| updated_at | IsoTimestamp | When the user was last updated. |
| last_sign_in_at | IsoTimestamp | null | The most recent successful sign-in time. |
| providers | string[] | Identity providers linked to the user. |
| identities | PublicIdentity[] | External identities linked to the user. |
| factors | PublicFactor[] | Multi-factor authentication factors enrolled by the user. |
| user_metadata | JsonObject | Metadata controlled by the user or application. |
| system_attributes | JsonObject | Metadata 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 })