AWS Cognito: CodeMismatchException: Invalid verification code provided, please try again
The confirmation or MFA code entered does not match what Cognito sent.
Invalid verification code provided Cognito Meaning
Confirmation, password-reset and MFA codes are single use. If the user requested a second code the first stops working, so a code copied from an older email or SMS is rejected with CodeMismatchException.
Common causes
- Typo in the code
- Older code used after a resend
- Code for a different user
- MFA code expired
- Code typed for a different user pool client
⚡ Quick fix
- Request a new code and use the latest
- Check the username used
- Show a resend button and tell users to use the newest code
- Compare the username used for request and confirmation
Detailed fix by platform
AWS CLI
aws cognito-idp resend-confirmation-code --client-id ID --username USER
How to diagnose
- Code — Latest code?
- User — Same username?
- Time — Within expiry?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- ExpiredCodeException AWS Cognito: ExpiredCodeException: Invalid code provided, please request a code again
- InvalidPasswordException AWS Cognito: InvalidPasswordException: Password did not conform with policy
- LimitExceededException AWS Cognito: LimitExceededException: Attempt limit exceeded, please try after some time
Most viewed in Authentication
- disallowed_useragent Google OAuth: Error 403: disallowed_useragent (sign-in from an embedded WebView)
- Access blocked: has not completed the Google verification process Google OAuth: Error 403: access_denied — The developer hasn't given you access to this app / has not completed the Google verification process
- redirect_uri_mismatch OAuth Error: redirect_uri_mismatch
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 28 Nov 2026