Skip to content

OAuthToken

Holds information of a token issued by an OAuth authorization endpoint.

Annotations
  • @JsonSerializable(fieldRename: FieldRename.snake, includeIfNull: false, explicitToJson: true)

Constructors

OAuthToken.fromJson

OAuthToken.fromJson(
  1. Map<String, dynamic> json
)

OAuthToken.fromTokenResponse

OAuthToken.fromTokenResponse(
  1. OidcToken response
)

OAuthToken

OAuthToken(
  1. String accessToken,
  2. String refreshToken,
  3. String tokenType,
  4. DateTime expiresAt,
  5. List<String> scope,
  6. String idToken,
)

Properties

accessToken

String accessToken
final

The OAuth access token.

expiresAt

DateTime expiresAt
getter/setter pair

Expires at DateTime.

expiresIn

int? expiresIn
getter/setter pair

The number of seconds until this token expires.

hasExpired

bool get hasExpired

Has the access token expired?

idToken

String idToken
final

The ID token used to uniquely identify the user with KeyCloak.

issuedDate

DateTime issuedDate
final

The date the access token was issued.

refreshToken

String refreshToken
final

The OAuth refresh token.

scope

List<String> scope
final

Scope of this token:

tokenInfo

String get tokenInfo

tokenType

String tokenType
final

The type of token.

Methods

clone

OAuthToken clone()

Clone this token.

expire

void expire()

Expire the authenticated OAuth token for this user.

toJson

Map<String, dynamic> toJson()

toString

String toString()
override

A string representation of this object.

Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.

Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.