Map<String, dynamic> asMap()

Emits this instance as a Map according to the OAuth 2.0 specification.

Source

Map<String, dynamic> asMap() {
  var map = {
    "access_token": accessToken,
    "token_type": type,
    "expires_in":
        expirationDate.difference(new DateTime.now().toUtc()).inSeconds,
  };

  if (refreshToken != null) {
    map["refresh_token"] = refreshToken;
  }

  if (scopes != null) {
    map["scope"] = scopes.map((s) => s.scopeString).join(" ");
  }

  return map;
}