Skip to content
Back

Changing password when logged using a OTP

  • 0
  • Flutter
  • Auth
eric34
7 Aug, 2025, 08:44

I'm developping in flutter/dart, I'm using email token to login to an existing user: _sessionToken = await account.createEmailToken(userId: app.ID.unique(), email: email); _session = await account.createSession(userId: _sessionToken.userId, secret: pin); Then, to set a new passwordI'm using: _currentUser = await account.updatePassword(password: newPassword, oldPassword: null); But I'm always getting an error: AppwriteException: user_invalid_credentials, Invalid credentials. Please check the email and password. (401) Is it supposed to work this way, if yes what I'm doing wrong, if no,, it means there is no way to recover an account using an e-mail token ?

TL;DR
Developers having issues changing a password after logging in with an email token in Flutter/Dart. The error "user_invalid_credentials" is received. The method used to update the password might not be correct for this scenario. If there is no way to recover an account using an email token, an alternative solution will be needed.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more