asMap method

Map<String, dynamic> asMap()

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

Implementation

Map<String, dynamic> asMap() {
  final map = {
    'access_token': accessToken,
    'expires_in': expirationDate.difference(DateTime.now().toUtc()).inSeconds,
  };

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

  return map;
}