title: Why is ResetPasswordAsync not working?
body: <p>When I call the code below, I always get <code>result.Succeeded = false</code></p>
  
  <pre><code>        [HttpPost]
          [AllowAnonymous]
          [ValidateAntiForgeryToken]
          public async Task&lt;ActionResult&gt; ResetPassword(ResetPasswordViewModel model)
          {
              if (!ModelState.IsValid)
              {
                  return View(model);
              }
              var user = await UserManager.FindByNameAsync(model.Email);
              if (user == null)
              {
                  // Don't reveal that the user does not exist
                  return RedirectToAction("ResetPasswordConfirmation", "Account");
              }
              string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id);
              var result = await UserManager.ResetPasswordAsync(user.Id, code, model.Password);
              //var result = await UserManager.ResetPasswordAsync(user.Id, model.Code, model.Password);
              if (result.Succeeded)
              {
                  return RedirectToAction("ResetPasswordConfirmation", "Account");
              }
              AddErrors(result);
              return View();
          }
  </code></pre>
  
  <p>The values for user.Id and Password are valid.  The result errors always say "Invalid Token" which I don't see as possible since I get it and instantly check it and it errors.  This is just a sanity test - I normally send the token via email to the user but that wasn't working either.</p>
  
  <p><strong>UPDATE 1</strong>  I define the UserManager in the same controller like this:</p>
  
  <pre><code>    private ApplicationSignInManager _signInManager;
      private ApplicationUserManager _userManager;
  
      public AccessController()
      {
      }
  
      public AccessController(ApplicationUserManager userManager, ApplicationSignInManager signInManager)
      {
          UserManager = userManager;
          SignInManager = signInManager;
      }
  
      public ApplicationSignInManager SignInManager
      {
          get
          {
              return _signInManager ?? HttpContext.GetOwinContext().Get&lt;ApplicationSignInManager&gt;();
          }
          private set
          {
              _signInManager = value;
          }
      }
  
      public ApplicationUserManager UserManager
      {
          get
          {
              return _userManager ?? HttpContext.GetOwinContext().GetUserManager&lt;ApplicationUserManager&gt;();
          }
          private set
          {
              _userManager = value;
          }
      }
  </code></pre>
  
  <p><strong>UPDATE 2</strong>  Here is my ApplicationUserManager code:</p>
  
  <pre><code>public class ApplicationUserManager : UserManager&lt;ApplicationUser&gt;
  {
      public ApplicationUserManager(IUserStore&lt;ApplicationUser&gt; store)
          : base(store)
      {
      }
  
      public static ApplicationUserManager Create(IdentityFactoryOptions&lt;ApplicationUserManager&gt; options, IOwinContext context) 
      {
          var manager = new ApplicationUserManager(new UserStore&lt;ApplicationUser&gt;(context.Get&lt;ApplicationDbContext&gt;()));
          // Configure validation logic for usernames
          manager.UserValidator = new UserValidator&lt;ApplicationUser&gt;(manager)
          {
              AllowOnlyAlphanumericUserNames = false,
              RequireUniqueEmail = true
          };
  
          // Configure validation logic for passwords
          manager.PasswordValidator = new PasswordValidator
          {
              RequiredLength = 6,
              RequireNonLetterOrDigit = true,
              RequireDigit = true,
              RequireLowercase = true,
              RequireUppercase = true,
          };
  
          // Configure user lockout defaults
          manager.UserLockoutEnabledByDefault = true;
          manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5);
          manager.MaxFailedAccessAttemptsBeforeLockout = 5;
  
          // Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
          // You can write your own provider and plug it in here.
          manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider&lt;ApplicationUser&gt;
          {
              MessageFormat = "Your security code is {0}"
          });
          manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider&lt;ApplicationUser&gt;
          {
              Subject = "Security Code",
              BodyFormat = "Your security code is {0}"
          });
          manager.EmailService = new EmailService();
          manager.SmsService = new SmsService();
          var dataProtectionProvider = options.DataProtectionProvider;
          if (dataProtectionProvider != null)
          {
              manager.UserTokenProvider = 
                  new DataProtectorTokenProvider&lt;ApplicationUser&gt;(dataProtectionProvider.Create("ASP.NET Identity"));
          }
          return manager;
      }
  }
  </code></pre>