OAuthConfig.fromJson constructor

OAuthConfig.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory OAuthConfig.fromJson(Map<String, dynamic> json) => OAuthConfig(
  authServerMetadataUrl: json['authServerMetadataUrl'] as String?,
  authorizationEndpoint: json['authorizationEndpoint'] as String,
  tokenEndpoint: json['tokenEndpoint'] as String,
  clientId: json['clientId'] as String,
  clientSecret: json['clientSecret'] as String?,
  redirectUri: json['redirectUri'] as String?,
  scopes: (json['scopes'] as List<dynamic>?)?.cast<String>() ?? const [],
  grantType: OAuthGrantType.values.firstWhere(
    (e) => e.name == json['grantType'],
    orElse: () => OAuthGrantType.authorizationCode,
  ),
  codeChallengeMethod: json['codeChallengeMethod'] as String? ?? 'S256',
);