RefreshingToken class
Compositional implementation of Token that automatically refreshes
an underlying OAuthToken when required (credential expiration <= 1 min)
upon access_token
attribute access.
- Inheritance
-
- Object
- Token
- OAuthToken
- RefreshingToken
Constructors
- RefreshingToken.new({required Credentials credentials, required DefaultScope scope, required Bearer tokenType, required String accessToken, required String refreshToken, int expiresAt = 0, int expiresIn = 0, String? localCache})
- Create new RefreshingToken.
Properties
- accessToken ↔ String
-
Access token setter to auto-refresh if it is expiring.
getter/setter pairinherited-setteroverride-getter
- credentials → Credentials
-
Credentials used for
access_token
refreshing.final - expiresAt ↔ int
-
UNIX epoch timestamp in seconds.
getter/setter pairinherited
- expiresIn ↔ int
-
Seconds until expiration from request timestamp.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isExpiring → bool
-
Wether this Token expires in the next 60 seconds.
no setterinherited
- localCache ↔ String?
-
Returns path to
_localCache
.getter/setter pair - refreshToken ↔ String
-
String used to obtain new access token upon expiration.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scope ↔ DefaultScope
-
Authentication scope.
getter/setter pairinherited
- tokenType ↔ Bearer
-
Literal
Bearer
.getter/setter pairinherited
Methods
-
asAuth(
) → String -
Returns authorization-header-ready String of tokenType and accessToken.
inherited
-
asJson(
) → String -
Returns this Token as Json String.
inherited
-
asMap(
) → JsonMap -
Returns JsonMap containing underlying token values.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
storeToken(
{String? path}) → void -
Write token values to Json file at specified
path
, defaulting to_localCache
. -
toString(
) → String -
A string representation of this object.
inherited
-
update(
JsonMap freshAccess) → void -
Update
access_token
and expiration attributes with a BaseTokenMap inplace.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
promptForToken(
OAuthCredentials credentials, {bool openBrowser = false, String? toFile}) → Future< RefreshingToken> - Method for CLI token creation via user inputs.