confirm method

Future<({bool existingUser})> confirm({
  1. String? email,
  2. required String challengeToken,
})

Confirms a verification challenge.

This method is used to confirm email verification challenges such as magic links or one-time codes. It validates the challenge token received from the verification process.

Parameters

  • email: The email address being verified (optional)
  • challengeToken: The challenge token from the verification process

Returns

A Future that resolves to a record containing:

  • existingUser: Whether a user with this email already exists

Throws

  • HttpException if there's a network error
  • CalljmpException if the challenge token is invalid

Example

final confirmation = await calljmp.users.auth.email.confirm(
  email: 'user@example.com',
  challengeToken: 'token-from-email',
);

print('User exists: ${confirmation.existingUser}');

Implementation

Future<({bool existingUser})> confirm({
  String? email,
  required String challengeToken,
}) => http
    .request("${_config.serviceUrl}/users/auth/email/confirm")
    .use(http.context(_config))
    .use(http.access())
    .post({"email": email, "token": challengeToken})
    .json((json) => (existingUser: json["existingUser"]));