updateEmailVerificationOTP method

Future<Token> updateEmailVerificationOTP({
  1. required String userId,
  2. required String secret,
})

Use this endpoint to complete the user email verification process using the 6-digit code that was emailed by createEmailVerificationOTP. Pass the userId of the user being verified along with the secret code from the email. If confirmed, this route will return a 200 status code and the code is consumed.

Implementation

Future<models.Token> updateEmailVerificationOTP({
  required String userId,
  required String secret,
}) async {
  final String apiPath = '/account/verifications/email/otp';

  final Map<String, dynamic> apiParams = {
    'userId': userId,
    'secret': secret,
  };

  final Map<String, String> apiHeaders = {
    'X-Appwrite-Project': client.config['project'] ?? '',
    'content-type': 'application/json',
    'accept': 'application/json',
  };

  final res = await client.call(
    HttpMethod.put,
    path: apiPath,
    params: apiParams,
    headers: apiHeaders,
  );

  return models.Token.fromMap(res.data);
}