Token class

Access token enabling to securely call protected APIs on behalf of the user.


Token({String? accessToken})
Access token enabling to securely call protected APIs on behalf of the user.
Token.fromJson(Map<String, dynamic>? json)
JSON map to Token factory.


accessToken String?
The requested access token. The app can use this token to authenticate to the secured resource, such as a web API.
getter/setter pair
expireOffSet int
Offset which is subtracted from expire time
expiresIn int?
How long the access token is valid (in seconds).
getter/setter pair
expireTimeStamp DateTime?
Predicted token expiration time.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
idToken String?
A JSON Web Token (JWT). The app can decode the segments of this token to request information about the user who signed in. The app can cache the values and display them, and confidential clients can use this for authorization. For more information about id_tokens, see the id_token reference. Note: Only provided if openid scope was requested.
getter/setter pair
issueTimeStamp DateTime
Current time when token was issued.
getter/setter pair
refreshToken String?
An OAuth 2.0 refresh token. The app can use this token acquire additional access tokens after the current access token expires. Refresh_tokens are long-lived, and can be used to retain access to resources for extended periods of time. For more detail on refreshing an access token, refer to the section below. Note: Only provided if offline_access scope was requested.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tokenType String?
Indicates the token type value. The only type that Azure AD supports is Bearer.
getter/setter pair


hasRefreshToken() bool
Check if Refresh Token is set.
hasValidAccessToken() bool
Check if Access Token is set and not expired.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toMap() Map
Convert this Token to JSON map.
toString() String
A string representation of this object.


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

Static Methods

fromMap(Map<String, dynamic>? map) Token
Convert JSON map to Token.
toJsonMap(Token model) Map
Convert Token to JSON map.