OAuthServerMetadata.fromJson constructor
Deserializes RFC 8414 server metadata.
Members with unexpected types are treated as absent rather than throwing, so a partially malformed document degrades gracefully.
Implementation
factory OAuthServerMetadata.fromJson(final Map<String, dynamic> json) {
String? asString(final String key) {
final value = json[key];
return value is String ? value : null;
}
final scopes = json['scopes_supported'];
return OAuthServerMetadata(
issuer: asString('issuer'),
pushedAuthorizationRequestEndpoint: asString(
'pushed_authorization_request_endpoint',
),
authorizationEndpoint: asString('authorization_endpoint'),
tokenEndpoint: asString('token_endpoint'),
scopesSupported: scopes is List
? scopes.whereType<String>().toList()
: null,
);
}