OauthToken class
Contains an OAuth compliant token
- Annotations
-
- @JsonSerializable()
Constructors
- OauthToken.new({required String accessToken, required int expiresIn, required String refreshToken, required String scope, required String tokenType, required DateTime created, String? provider})
-
Creates a new token
const
-
OauthToken.fromJson(Map<
String, dynamic> json) -
Creates a new OauthToken from the given
json
factory - OauthToken.fromText(String text, {String? provider, String? refreshToken})
-
Parses a new token from the given
text
.factory
Properties
- accessToken → String
-
Token for API access
final
- created → DateTime
-
UTC time of creation of this token
final
- expiresDateTime → DateTime
-
Retrieves the expiry date time
no setter
- expiresIn → int
-
Expiration in seconds from created time
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isExpired → bool
-
Checks if this token is expired
no setter
- isValid → bool
-
Checks if this token is still valid, ie not expired.
no setter
- provider → String?
-
Optional, implementation-specific provider
final
- refreshToken → String
-
Token for refreshing the accessToken
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scope → String
-
Granted scope(s) for access
final
- tokenType → String
-
Type of the token
final
Methods
-
copyWith(
String accessToken, int expiresIn) → OauthToken -
Refreshes this token with the new
accessToken
andexpiresIn
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this OauthToken to JSON.
-
toString(
) → String -
A string representation of this object.
override
-
willExpireIn(
Duration duration) → bool -
Checks if the token is already expired or will expire
within the given (positive)
duration
, e.g.const Duration(minutes: 15)
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited