private async Task SignInAsync(AspNetUser user, bool isPersistent) { var clientKey = Request.Browser.Type;// +Request.Headers["X-NuGet-ApiKey"]; await UserManager.SignInClientAsync(user, clientKey); // Zerando contador de logins errados. await UserManager.ResetAccessFailedCountAsync(user.Id); // Coletando Claims externos (se houver) ClaimsIdentity ext = await AuthenticationManager.GetExternalIdentityAsync(DefaultAuthenticationTypes.ExternalCookie); // Criação da instancia do Identity e atribuição dos Claims var claims = await user.GenerateUserIdentityAsync(UserManager, ext); AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie, DefaultAuthenticationTypes.TwoFactorCookie, DefaultAuthenticationTypes.ApplicationCookie); AuthenticationManager.SignIn( new AuthenticationProperties { IsPersistent = isPersistent }, claims ); }