OidcIdToken class

The OpenID Connect ID token: the provider's signed statement of who logged in, for which client, and when.

The token endpoint returns it next to the access token when the login asked for the openid scope. The login checks it (issuer, audience, expiry, nonce) and builds the claims of the user from it. It is also the id_token_hint that ends the provider's session on logout. Its value is a JWT (header.payload.signature).

final user = login.user as OidcUser;
final idToken = user.idToken;
log.info('${idToken.subject} logged in at ${idToken.authenticatedAt}');

Spring (Java): OidcIdToken.

Inheritance
Mixed-in types

Constructors

OidcIdToken(String tokenValue, {required Map<String, Object?> claims, DateTime? issuedAt, DateTime? expiresAt})
An ID token with tokenValue and its claims, issued at issuedAt and expiring at expiresAt.
OidcIdToken.parse(String tokenValue)
Reads the JWT tokenValue: its header must be a JSON object whose alg is not none, its payload a JSON object of claims.
factory

Properties

accessTokenHash → String?
at_hash.
no setterinherited
address → Map<String, Object?>?
address: a JSON object (street_address, locality, ...).
no setterinherited
audience → List<String>
aud: the clients the token is for; it must name this one.
no setterinherited
authenticatedAt → DateTime?
auth_time: when the user last entered credentials (UTC).
no setterinherited
authenticationContextClass → String?
acr.
no setterinherited
authenticationMethods → List<String>?
amr.
no setterinherited
authorizationCodeHash → String?
c_hash.
no setterinherited
authorizedParty → String?
azp: the client the token was issued to.
no setterinherited
birthdate → String?
birthdate, as written (YYYY-MM-DD, or a year alone).
no setterinherited
claims → Map<String, Object?>
The claims, by name; cannot be modified.
final
email → String?
email.
no setterinherited
emailVerified → bool?
email_verified: whether the provider checked the email.
no setterinherited
expiresAt → DateTime?
exp: when the token expires (UTC).
no setterinherited
familyName → String?
family_name.
no setterinherited
fullName → String?
name: the full name.
no setterinherited
gender → String?
gender.
no setterinherited
givenName → String?
given_name.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
issuedAt → DateTime?
iat: when the token was issued (UTC).
no setterinherited
issuer → String?
iss: the provider that issued the token.
no setterinherited
locale → String?
locale, such as en-US.
no setterinherited
middleName → String?
middle_name.
no setterinherited
nickName → String?
nickname.
no setterinherited
nonce → String?
nonce: what the client sent in the authorization request (here, its SHA-256 hash).
no setterinherited
phoneNumber → String?
phone_number.
no setterinherited
phoneNumberVerified → bool?
phone_number_verified.
no setterinherited
picture → String?
picture: the URL of the picture.
no setterinherited
preferredUsername → String?
preferred_username: the name the user goes by, not unique.
no setterinherited
profile → String?
profile: the URL of the profile page.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
subject → String?
sub: the user's id at the provider; never changes for one user.
no setterinherited
tokenValue → String
The token itself, as the provider issued it; a credential, never log it.
finalinherited
updatedAt → DateTime?
updated_at: when the profile last changed.
no setterinherited
website → String?
website.
no setterinherited
zoneInfo → String?
zoneinfo: the time zone, such as Europe/Paris.
no setterinherited

Methods

getClaimAsBoolean(String name) → bool?
The claim name as a boolean: true / false or the strings "true" / "false"; null when absent or anything else.
inherited
getClaimAsInstant(String name) → DateTime?
The claim name as a time: seconds since 1970 (a NumericDate), in UTC; null when absent or not a number.
inherited
getClaimAsMap(String name) → Map<String, Object?>?
The claim name as a JSON object; null when absent or not an object.
inherited
getClaimAsString(String name) → String?
The claim name as text (toString() of a number); null when absent.
inherited
getClaimAsStringList(String name) → List<String>?
The claim name as a list of text: a single string gives a list of one; null when absent.
inherited
hasClaim(String name) → bool
Whether the claim name is present (even with a null value).
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

maxLength → const int
The longest raw token OidcIdToken.parse reads.