createOauth2Credential method

Future<TCreateOauth2CredentialResponse> createOauth2Credential({
  1. required TCreateOauth2CredentialBody input,
})

Enable authentication for end users with an OAuth 2.0 provider

Sign the provided TCreateOauth2CredentialBody with the client's stamp function and submit the request (POST /public/v1/submit/create_oauth2_credential).

See also: stampCreateOauth2Credential.

Implementation

Future<TCreateOauth2CredentialResponse> createOauth2Credential({
  required TCreateOauth2CredentialBody input,
}) async {
  final body = packActivityBody(
    bodyJson: input.toJson(),
    fallbackOrganizationId: input.organizationId ??
        config.organizationId ??
        (throw Exception(
            "Missing organization ID, please pass in a sub-organizationId or instantiate the client with one.")),
    activityType: 'ACTIVITY_TYPE_CREATE_OAUTH2_CREDENTIAL',
  );
  return await request<Map<String, dynamic>, TCreateOauth2CredentialResponse>(
      "/public/v1/submit/create_oauth2_credential",
      body,
      (json) => TCreateOauth2CredentialResponse.fromJson(
          transformActivityResponse(json, 'CreateOauth2Credential')));
}