title: Identity reset/confirm-token valid at localhost, but invalid when testing at server
body: <p>I have an 'admin' application which has this controller and runs on localhost X:</p>
  
  <pre class="lang-cs prettyprint-override"><code>[HttpPost][ValidateAntiForgeryToken]
          public async Task&lt;ActionResult&gt; StuurActivatieEmail(EditPostModel model)
          {
              Task&lt;AppUser&gt; appUserTask = AppUserManager.FindByNameAsync(model.usernaam);
  
              AppUser appUser = await appUserTask;
              if (appUser == null) 
                   return View("Error", new string[] 
                                  { selectedTable + " niet gevonden." });
              string confirmCode = AppUserManager.GenerateEmailConfirmationToken(appUser.Id);
              string resetCode = AppUserManager.GeneratePasswordResetToken(appUser.Id);
              string userId = System.Web.HttpUtility.UrlEncode(appUser.Id);
  
              confirmCode = System.Web.HttpUtility.UrlEncode(confirmCode);
              resetCode = System.Web.HttpUtility.UrlEncode(resetCode);
  
              var callbackUrl = "http://www.example.nl/Newportal/Account/ConfirmEmail?";
  
              callbackUrl += "userId=" + userId + "&amp;";
              callbackUrl += "confirmCode=" + confirmCode + "&amp;";
              callbackUrl += "resetCode=" + resetCode;
              Task sendEmailTask = AppUserManager.SendEmailAsync(appUser.Id, "Activeer uw Oostendorp Nederland account", "Geachte heer/mevrouw,&lt;br /&gt;&lt;br /&gt;bla bla &lt;a href=\"" + callbackUrl + "\"&gt;link&lt;/a&gt; bla bla.");
              string succesMsg = "Er is succesvol een mail verzonden.";
              TempData["SuccesMessage"] = succesMsg;
              await sendEmailTask;
              return RedirectToAction("Index", "Table", new { selectedTable });
          }
  </code></pre>
  
  <p>The above code sends an email.</p>
  
  <p>I have another normal 'user' application which runs on localhost Y. When I copy the link and change the domain to my localhost Y the ConfirmEmail action method validates the emailConfirmationToken(confirmCode) and then sends the user(if code is succesfully validated) to a form where he can submit his password. The passwordResetToken(resetPassword) is passed in as a hidden value.</p>
  
  <pre class="lang-cs prettyprint-override"><code>[AllowAnonymous]
  public async Task&lt;ActionResult&gt; ConfirmEmail(string userId, string confirmCode, string resetCode)
  {
      if (userId == null || confirmCode == null || resetCode == null)
      {
          return View("Error", new string[] { "Er is een onbekende fout opgetreden" });
      }
      var result = await AppUserManager.ConfirmEmailAsync(userId, confirmCode);
      if (result.Succeeded) 
      {
          return RedirectToAction("ResetPassword", new { code = resetCode });
      }
      return View("Error", new string[] { "Er is een onbekende fout opgetreden." });
  }
  </code></pre>
  
  <p>Once this form is submitted the ResetPassword action method is invoked. When the passwordResetToken is correct and the password requirements are met the password (or at least its hash) is succesfully saved and the user can login.</p>
  
  <pre class="lang-cs prettyprint-override"><code>[HttpPost]
  [AllowAnonymous]
  [ValidateAntiForgeryToken]
  public async Task&lt;ActionResult&gt; ResetPassword(ResetPasswordVM model)
  {
      if (!ModelState.IsValid)
      {
          return View(model);
      }
      AppUser appUser = await AppUserManager.FindByNameAsync(model.UserName);
      if (appUser == null)
      {
          // Don't reveal that the user does not exist
          return RedirectToAction("ResetPasswordConfirmation", "Account");
      }
      var result = await AppUserManager.ResetPasswordAsync(appUser.Id, model.Code, model.NewPassword);
      if (result.Succeeded)
      {
          return RedirectToAction("ResetPasswordConfirmation", "Account");
      }
      AddErrorsFromResult(result);
      return View();
  }
  </code></pre>
  
  <p>However, when I publish all this to our server and test it over there a get an invalid token errormessage, any help would be greatly appreciated since I am out off options </p>