MVC 5 ASP.NET Identity 2: Capture user's preference for “remember me” in ExternalLogin

后端 未结 2 1704
广开言路
广开言路 2021-01-20 14:29

I am using the Identity 2.0 Sample.

I get that by setting isPersistent to true in ExternalLoginCallback action method, the browser will automatically log the user in

2条回答
  •  不要未来只要你来
    2021-01-20 15:23

    Check out the AccountController.ExternalLoginConfirmation action and note the call to await SignInHelper.SignInAsync(user, isPersistent: false, rememberBrowser: false). You can set those values to true, or you can update the ExternalLoginConfirmationViewModel and corresponding ExternalLoginConfirmation view to let the user decide.

    BTW: isPersistent will persist the users session across closing and reopening their browser. The rememberBrowser argument is particular to two factor authentication and it sounds like should be left false for your circumstance.

    Tangentially related Supporting remember me with two factor authentication

提交回复
热议问题