TokenResponse class
Represents an OAuth2 token response from Frappe server
Contains access token, refresh token, and expiration information with utility methods for token validation and expiration checking.
- Annotations
-
- @JsonSerializable.new()
Constructors
Properties
- accessToken → String
-
The access token used for API authentication
final
- expiresAt → DateTime
-
Calculates the exact expiration time
no setter
- expiresIn → int
-
Token expiration time in seconds from issuance
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isExpired → bool
-
Checks if the token is currently expired
no setter
- issuedAt → DateTime
-
Timestamp when the token was issued
final
- isValid → bool
-
Checks if the token is valid (not expired and has required fields)
no setter
- refreshToken → String
-
The refresh token used to obtain new access tokens
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
scope
→ List<
String> ? -
OAuth2 scopes granted to this token
final
- timeUntilExpiration → Duration
-
Returns the remaining time until expiration
no setter
- tokenType → String
-
Token type (usually "Bearer")
final
Methods
-
copyWith(
{String? accessToken, String? refreshToken, int? expiresIn, String? tokenType, DateTime? issuedAt, List< String> ? scope}) → TokenResponse - Creates a copy of this TokenResponse with updated fields
-
isExpiringSoon(
[Duration threshold = const Duration(minutes: 5)]) → bool - Checks if the token is expiring soon (within 5 minutes by default)
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts TokenResponse to JSON
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override