clientDynamicReg function

Future<String> clientDynamicReg(
  1. String regEndpoint,
  2. List reidirUrlList,
  3. String authMethod,
  4. List scopes,
)

Dynamically register the user in the POD server

Implementation

Future<String> clientDynamicReg(String regEndpoint, List reidirUrlList,
    String authMethod, List scopes) async {
  final response = await http.post(Uri.parse(regEndpoint),
      headers: <String, String>{
        'Accept': '*/*',
        'Content-Type': 'application/json',
        'Connection': 'keep-alive',
        'Accept-Encoding': 'gzip, deflate, br',
        // 'Sec-Fetch-Dest': 'empty',
        // 'Sec-Fetch-Mode': 'cors',
        // 'Sec-Fetch-Site': 'cross-site',
      },
      body: json.encode({
        "application_type": "web",
        "scope": scopes.join(' '),
        "grant_types": ["authorization_code", "refresh_token"],
        "redirect_uris": reidirUrlList,
        "token_endpoint_auth_method": authMethod,
        //"client_name": "fluttersolidauth",
        //"id_token_signed_response_alg": "RS256",
        //"subject_type": "pairwise",
        //"userinfo_encrypted_response_alg": "RSA1_5",
        //"userinfo_encrypted_response_enc": "A128CBC-HS256",
      }));

  if (response.statusCode == 201) {
    /// If the server did return a 200 OK response,
    /// then parse the JSON.
    return response.body;
  } else {
    /// If the server did not return a 200 OK response,
    /// then throw an exception.
    throw Exception('Failed to load data! Try again in a while.');
  }
}