stampOauth2Authenticate method

Future<TSignedRequest> stampOauth2Authenticate({
  1. required TOauth2AuthenticateBody input,
})

Produce a SignedRequest from TOauth2AuthenticateBody by using the client's stamp function.

See also: Oauth2Authenticate.

Implementation

Future<TSignedRequest> stampOauth2Authenticate({
  required TOauth2AuthenticateBody input,
}) async {
  final fullUrl = '${config.baseUrl}/public/v1/submit/oauth2_authenticate';
  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',
  );
  final bodyJson = jsonEncode(body);
  final stamp = await stamper.stamp(bodyJson);

  return TSignedRequest(
    body: bodyJson,
    stamp: stamp,
    url: fullUrl,
  );
}