authByCode static method

Future<AuthResult> authByCode(
  1. String code,
  2. String codeVerifier,
  3. String redirectUrl
)

auth by OIDC code

Implementation

static Future<AuthResult> authByCode(
    String code, String codeVerifier, String redirectUrl) async {
  String body = "client_id=" +
      Authing.sAppId +
      "&grant_type=authorization_code" +
      "&code=" +
      code +
      "&code_verifier=" +
      codeVerifier +
      "&redirect_uri=" +
      redirectUrl;
  var url = Uri.parse('https://' + Authing.sHost + '/oidc/token');
  Map<String, String> headers = {
    "x-authing-userpool-id": Authing.sUserPoolId,
    "x-authing-app-id": Authing.sAppId,
    "x-authing-request-from": "sdk-flutter",
    "x-authing-sdk-version": Authing.VERSION,
    "content-type": "application/x-www-form-urlencoded"
  };
  var response = await http.post(url, headers: headers, body: body);
  final Result result = parseResponse(response);
  AuthResult authResult = AuthResult(result);
  authResult.user = await createUser(result);
  return authResult;
}