OAuthAccessToken class

Represents an issued access token.

Constructors

OAuthAccessToken({required String tokenHash, required String clientId, required String userId, required String scope, required DateTime expiresAt, String? refreshTokenHash, DateTime? refreshTokenExpiresAt, int refreshTokenUses = 0, DateTime? issuedAt, String? authorizationId})
Creates a persistence-safe access-token record.
const

Properties

authorizationId String?
Authorization that produced this record, for authorization-code grants.
final
clientId String
Client the token was issued to.
final
expiresAt DateTime
When the access token expires.
final
hashCode int
The hash code for this object.
no setterinherited
issuedAt DateTime?
When the token was issued.
final
refreshTokenExpiresAt DateTime?
When the refresh token expires (optional). When present, refresh-token grants validate this timestamp instead of expiresAt so a refresh token remains usable after the access token has expired. When null, the refresh token is considered to never expire on its own and is only invalidated by revocation.
final
refreshTokenHash String?
Digest of the opaque refresh token held by the client (optional).
final
refreshTokenUses int
Number of times this refresh token has been consumed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scope String
Granted scopes.
final
tokenHash String
Digest of the opaque access token held by the client.
final
userId String
User the token represents.
final

Methods

copyWith({String? tokenHash, String? clientId, String? userId, String? scope, DateTime? expiresAt, String? refreshTokenHash, DateTime? refreshTokenExpiresAt, int? refreshTokenUses, DateTime? issuedAt, String? authorizationId}) OAuthAccessToken
Creates an immutable copy with selected values replaced.
isRefreshTokenValid({DateTime? now}) bool
Whether the refresh token is still valid. A null refreshTokenHash is never valid. When refreshTokenExpiresAt is null the refresh token does not expire on its own; callers must additionally check revocation via the access-token store.
isValid({DateTime? now}) bool
Whether the access token is still valid.
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