oauth2Authenticate method

Future<TOauth2AuthenticateResponse> oauth2Authenticate({
  1. required TOauth2AuthenticateBody input,
})

Authenticate a user with an OAuth 2.0 provider and receive an OIDC token to use with the LoginWithOAuth or CreateSubOrganization activities

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

See also: stampOauth2Authenticate.

Implementation

Future<TOauth2AuthenticateResponse> oauth2Authenticate({
  required TOauth2AuthenticateBody 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_OAUTH2_AUTHENTICATE',
  );
  return await request<Map<String, dynamic>, TOauth2AuthenticateResponse>(
      "/public/v1/submit/oauth2_authenticate",
      body,
      (json) => TOauth2AuthenticateResponse.fromJson(
          transformActivityResponse(json, 'Oauth2Authenticate')));
}