Answers.Body: <p>Those codes are valid for as long as whatever <a href="https://docs.craftcms.com/v3/config/config-settings.html#verificationcodeduration" rel="nofollow noreferrer">verificationCodeDuration</a> is set to (24 hours by default).</p>
  
  <p>Guessing the users that are getting that are hitting expired verification codes.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-02T21:12:57.540Z
Answers.LastActivityDate: 2020-06-02T21:12:57.540Z
Answers.UserDisplayName: Brad Bell
Body: <p>I am using Craft CMS as a backend for react Next app. On our live site we are sometimes getting complaints from the user about error when user try to verify code sent in the email.</p>
  
  <p>This case doesn't happen with every user but very for random users. For this reason I am not able to find the reason for the issue and fix it.<br>
  Everytime I see following information in the log file.</p>
  
  <blockquote>
    <p>2020-05-27 10:17:35 [-][-][-][warning][craft\services\Users::isVerificationCodeValidForUser] The verification code (gqkZpvgTZDMNSXRyNuXE4ksxpNOlBOl) given for userId: 99965 does not match the hash in the database.
    2020-05-27 10:17:35 [-][-][-][info][application] $_GET = [
        'p' => 'ACT/craft-rest-api/user/verify-email'
        'code' => 'gqkZpvgTZDMNSXRyNuXE4ksxpNOlBOl'
        'id' => 'ef2156d6-306b-4a88-80bb-25ca26562702'
    ]</p>
  </blockquote>
  
  <p>Here is the information about the system.</p>
  
  <p>PHP version 7.4.5</p>
  
  <p>OS version  Linux 3.10.0-1127.el7.x86_64</p>
  
  <p>Database driver &amp; version   MySQL 8.0.20</p>
  
  <p>Image driver &amp; version  GD 7.4.5</p>
  
  <p>Craft edition &amp; version Craft Pro 3.4.21</p>
  
  <p>Yii version 2.0.35</p>
  
  <p>Twig version    2.12.5</p>
  
  <p>Guzzle version  6.5.4</p>
  
  <p>Imagine version 1.2.3-dev</p>
  
  <p>Plugins:-</p>
  
  <p>Amazon S3   1.2.8</p>
  
  <p>Architect   2.3.3</p>
  
  <p>CKEditor    1.0.0-beta.3</p>
  
  <p>Comments    1.5.6</p>
  
  <p>Contact Form    2.2.7</p>
  
  <p>Craft-Rest-Api  1.1.0</p>
  
  <p>Enforce password    1.0.0</p>
  
  <p>Image Resizer   2.0.9</p>
  
  <p>Klaviyo Connect 3.1.3.2</p>
  
  <p>Redactor    2.6.1</p>
  
  <p>SendGrid    1.2.0</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-31T19:53:32.583Z
Comments.Text: What's ``verificationCodeDuration`` set to?
Comments.UserDisplayName: RitterKnight
Tags: <craft3><craft-pro>
Title: Getting invalid verification code for email confirmation
ThreadText: # Getting invalid verification code for email confirmation
  
  (Asked by: username_0 on 2020-05-29)
  
  I am using Craft CMS as a backend for react Next app. On our live site we are sometimes getting complaints from the user about error when user try to verify code sent in the email.
  
  This case doesn't happen with every user but very for random users. For this reason I am not able to find the reason for the issue and fix it.  
  Everytime I see following information in the log file.
  
  > 2020-05-27 10:17:35 [-][-][-][warning][craft\services\Users::isVerificationCodeValidForUser] The verification code (gqkZpvgTZDMNSXRyNuXE4ksxpNOlBOl) given for userId: 99965 does not match the hash in the database.
  > 2020-05-27 10:17:35 [-][-][-][info][application] $\_GET = [
  > 'p' => 'ACT/craft-rest-api/user/verify-email'
  > 'code' => 'gqkZpvgTZDMNSXRyNuXE4ksxpNOlBOl'
  > 'id' => 'ef2156d6-306b-4a88-80bb-25ca26562702'
  > ]
  
  Here is the information about the system.
  
  PHP version 7.4.5
  
  OS version Linux 3.10.0-1127.el7.x86\_64
  
  Database driver & version MySQL 8.0.20
  
  Image driver & version GD 7.4.5
  
  Craft edition & version Craft Pro 3.4.21
  
  Yii version 2.0.35
  
  Twig version 2.12.5
  
  Guzzle version 6.5.4
  
  Imagine version 1.2.3-dev
  
  Plugins:-
  
  Amazon S3 1.2.8
  
  Architect 2.3.3
  
  CKEditor 1.0.0-beta.3
  
  Comments 1.5.6
  
  Contact Form 2.2.7
  
  Craft-Rest-Api 1.1.0
  
  Enforce password 1.0.0
  
  Image Resizer 2.0.9
  
  Klaviyo Connect 3.1.3.2
  
  Redactor 2.6.1
  
  SendGrid 1.2.0
  
  **Tags:** craft3, craft-pro
  
  > **Comments:**
  > **username_1**: What's ``verificationCodeDuration`` set to?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-06-02. Score: 1
  
  Those codes are valid for as long as whatever [verificationCodeDuration](https://docs.craftcms.com/v3/config/config-settings.html#verificationcodeduration) is set to (24 hours by default).
  
  Guessing the users that are getting that are hitting expired verification codes.
  
  
  ---
  
  