Skip to main content

Interface: UserIdentity

server.UserIdentity

Information about an authenticated user, derived from a JWT.

The only fields guaranteed to be present are tokenIdentifier and issuer. All remaining fields may or may not be present depending on the information given by the identity provider.

The explicitly listed fields are derived from the OpenID Connect (OIDC) standard fields, see the OIDC specification for more information on these fields.

Any additional fields are custom claims that may be present in the JWT, and their type depends on your identity provider configuration. If you know the type of the field, you can assert it in TypeScript like this (for example as a string):

const identity = await ctx.auth.getUserIdentity();
if (identity === null) {
return null;
}
const customClaim = identity.custom_claim as string;

Indexable

▪ [key: string]: JSONValue | undefined

Properties

tokenIdentifier

Readonly tokenIdentifier: string

A stable and globally unique string for this identity (i.e. no other user, even from a different identity provider, will have the same string.)

JWT claims: sub + iss

Defined in

server/authentication.ts:38


subject

Readonly subject: string

Identifier for the end-user from the identity provider, not necessarily unique across different providers.

JWT claim: sub

Defined in

server/authentication.ts:46


issuer

Readonly issuer: string

The hostname of the identity provider used to authenticate this user.

JWT claim: iss

Defined in

server/authentication.ts:53


name

Optional Readonly name: string

JWT claim: name

Defined in

server/authentication.ts:58


givenName

Optional Readonly givenName: string

JWT claim: given_name

Defined in

server/authentication.ts:63


familyName

Optional Readonly familyName: string

JWT claim: family_name

Defined in

server/authentication.ts:68


nickname

Optional Readonly nickname: string

JWT claim: nickname

Defined in

server/authentication.ts:73


preferredUsername

Optional Readonly preferredUsername: string

JWT claim: preferred_username

Defined in

server/authentication.ts:78


profileUrl

Optional Readonly profileUrl: string

JWT claim: profile

Defined in

server/authentication.ts:83


pictureUrl

Optional Readonly pictureUrl: string

JWT claim: picture

Defined in

server/authentication.ts:88


email

Optional Readonly email: string

JWT claim: email

Defined in

server/authentication.ts:93


emailVerified

Optional Readonly emailVerified: boolean

JWT claim: email_verified

Defined in

server/authentication.ts:98


gender

Optional Readonly gender: string

JWT claim: gender

Defined in

server/authentication.ts:103


birthday

Optional Readonly birthday: string

JWT claim: birthdate

Defined in

server/authentication.ts:108


timezone

Optional Readonly timezone: string

JWT claim: zoneinfo

Defined in

server/authentication.ts:113


language

Optional Readonly language: string

JWT claim: locale

Defined in

server/authentication.ts:118


phoneNumber

Optional Readonly phoneNumber: string

JWT claim: phone_number

Defined in

server/authentication.ts:123


phoneNumberVerified

Optional Readonly phoneNumberVerified: boolean

JWT claim: phone_number_verified

Defined in

server/authentication.ts:128


address

Optional Readonly address: string

JWT claim: address

Defined in

server/authentication.ts:133


updatedAt

Optional Readonly updatedAt: string

JWT claim: updated_at

Defined in

server/authentication.ts:138