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:107


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:115


issuer

Readonly issuer: string

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

JWT claim: iss

Defined in

server/authentication.ts:122


name

Optional Readonly name: string

JWT claim: name

Defined in

server/authentication.ts:127


givenName

Optional Readonly givenName: string

JWT claim: given_name

Defined in

server/authentication.ts:132


familyName

Optional Readonly familyName: string

JWT claim: family_name

Defined in

server/authentication.ts:137


nickname

Optional Readonly nickname: string

JWT claim: nickname

Defined in

server/authentication.ts:142


preferredUsername

Optional Readonly preferredUsername: string

JWT claim: preferred_username

Defined in

server/authentication.ts:147


profileUrl

Optional Readonly profileUrl: string

JWT claim: profile

Defined in

server/authentication.ts:152


pictureUrl

Optional Readonly pictureUrl: string

JWT claim: picture

Defined in

server/authentication.ts:157


email

Optional Readonly email: string

JWT claim: email

Defined in

server/authentication.ts:162


emailVerified

Optional Readonly emailVerified: boolean

JWT claim: email_verified

Defined in

server/authentication.ts:167


gender

Optional Readonly gender: string

JWT claim: gender

Defined in

server/authentication.ts:172


birthday

Optional Readonly birthday: string

JWT claim: birthdate

Defined in

server/authentication.ts:177


timezone

Optional Readonly timezone: string

JWT claim: zoneinfo

Defined in

server/authentication.ts:182


language

Optional Readonly language: string

JWT claim: locale

Defined in

server/authentication.ts:187


phoneNumber

Optional Readonly phoneNumber: string

JWT claim: phone_number

Defined in

server/authentication.ts:192


phoneNumberVerified

Optional Readonly phoneNumberVerified: boolean

JWT claim: phone_number_verified

Defined in

server/authentication.ts:197


address

Optional Readonly address: string

JWT claim: address

Defined in

server/authentication.ts:202


updatedAt

Optional Readonly updatedAt: string

JWT claim: updated_at

Defined in

server/authentication.ts:207