ExternalAuthOptions.fromMap constructor

ExternalAuthOptions.fromMap(
  1. Map<String, dynamic> map
)

Returns a JSON-friendly representation of this object.

Parses the following fields:

  • client_id
  • client_secret
  • redirect_uri

Implementation

factory ExternalAuthOptions.fromMap(Map<String, dynamic> map) {
  var clientId = map['client_id'];
  var clientSecret = map['client_secret'];
  if (clientId == null || clientSecret == null) {
    _log.severe('clientId or clientSecret is null');
    throw ArgumentError('Invalid clientId and/or clientSecret');
  }

  return ExternalAuthOptions(
    clientId: clientId,
    clientSecret: clientSecret,
    redirectUri: map['redirect_uri'],
    scopes: map['scopes'] is Iterable
        ? ((map['scopes'] as Iterable).map((x) => x.toString()))
        : <String>[],
  );
}