OAuthToken class

Wrapper for an OAuth token implementing expiration methods.

Inheritance
Implementers

Constructors

OAuthToken.new({required DefaultScope scope, required Bearer tokenType, required String accessToken, required String refreshToken, int expiresAt = 0, int expiresIn = 0})
Create new OAuthToken.
OAuthToken.fromJsonFile(String path)
Creates new OAuthToken from a Json file stored in path.
factory

Properties

accessToken String
String to be used in authorization header.
getter/setter pairinherited
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 setteroverride
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
toString() String
A string representation of this object.
inherited
update(JsonMap freshAccess) → void
Update access_token and expiration attributes with a BaseTokenMap inplace.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

isOAuth(Map<String, String> headers) bool
Wether headers is valid for OAuth.