Skip to content
Back

Bug: TOTP MFA verification always fails with `user_invalid_token`

  • 0
  • Auth
  • Web
  • Cloud
Software4me
3 Mar, 2026, 07:58

Bug: TOTP MFA verify always returns user_invalid_token (Cloud 1.8.1, Frankfurt)*

Project ID: 68dd48440003e537d849 SDK: appwrite@18.2.0 (also tested with 16.1.0)

createMfaAuthenticator({ type: 'totp' }) works and returns a valid secret/URI. Authenticator app generates codes fine. But updateMfaAuthenticator AND the challenge flow (createMfaChallengeupdateMfaChallenge) both always fail with 401 user_invalid_token.

This worked perfectly ~1 day ago with the same codebase. Then it stopped without any code changes. Tested with fresh accounts, incognito mode, different browsers, cleared cookies — same error every time.

I verified client-side with Web Crypto API that the OTP code is mathematically correct (SHA-1 matches the authenticator app). Also tried SHA-256/SHA-512 with ±30s time offsets — server rejects everything. Also tried direct fetch bypassing the SDK entirely, with and without X-Appwrite-Response-Format header — same result.

One thing I noticed: the returned secret is 64 bytes (103 base32 chars), which is way longer than the usual 20-byte TOTP secret. The URI has no algorithm parameter. It seems like the server might verify against a different secret or algorithm than what it returns.

Is this a known issue with Cloud 1.8.1? Any workaround?

Thanks!

TL;DR
Bug: TOTP MFA verification consistently fails with 'user_invalid_token' error despite correct implementation. This issue began suddenly without any code changes. The server may be verifying against a different secret or algorithm. No known solution at the moment.
Software4me
3 Mar, 2026, 08:04

Bug: TOTP MFA verification always fails with user_invalid_token

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