appwrite/sdk-for-web

๐Ÿ› Bug Report: Appwrite Rest endpoint expects 'passwordAgain' param when calling account.updateRecovery

Closed this issue ยท 3 comments

๐Ÿ‘Ÿ Reproduction steps

Install appwrite web sdk, configure w/ v1 endpoint (https://cloud.appwrite.io/v1), and attempt to call account.updateRecovery. The method accepts 3 args (userId, secret, and password), but the endpoint is expecting a separate "passwordAgain" param.
Also, docs still show that the method accepts a 4th "paswordAgain" arg, but in v14.0.0 of sdk it does not support that argument.

๐Ÿ‘ Expected behavior

I'm able to use the updateRecovery method to confirm password reset by passing 3 arguments - userId, secret, and password.

๐Ÿ‘Ž Actual Behavior

I get an error saying that "passwordAgain" param is required, but updateRecovery method does not support it.

๐ŸŽฒ Appwrite version

Different version (specify in environment)

๐Ÿ’ป Operating system

MacOS

๐Ÿงฑ Your Environment

Local environment, node 20.5.1, appwrite 14.0.0 configured with v1 endpoint

๐Ÿ‘€ Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

๐Ÿข Have you read the Code of Conduct?

@clnmcgrw Faced same issue, looks like there is a mismatch between actual implementation and the latest package code. Had to downgrade the version to 13 for the time being where the updateRecovery method actually supports the passwordAgain argument and is working currently.

In case anyone else runs into this or a similar api/sdk mismatch - you can always just use the client instance to hit the rest api or shim the account method that's not working, ie:

account.updateRecovery = (
  userId: string,
  secret: string,
  password: string,
  passwordAgain: string,
): Promise<Models.Token> => {
  if (!userId || !secret || !password || !passwordAgain) {
    throw new Error('Missing argument');
  }
  const uri = new URL(client.config.endpoint + '/account/recovery');
  return await client.call('put', uri, {
    'content-type': 'application/json',
  }, { userId, secret, password, passwordAgain });
};

@clnmcgrw, you were probably using an SDK meant for Appwrite version 1.5 while Appwrite Cloud was on version 1.4. It's important to make sure you use a version of the SDK that is compatible with Appwrite. The readme will mention. For example:

Version 15.0.0 of the web SDK:

**This SDK is compatible with Appwrite server version 1.5.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-web/releases).**

Version 13.0.2 of the web SDK

**This SDK is compatible with Appwrite server version 1.4.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-web/releases).**