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 the next time (within limits) they visit using the same browser. I know that if the user's "remember me" preference was captured and passed to the ExternalLogin action method that it could be put into returnUrl and accessed in ExternalLoginCallback. But how do I get their preference to the ExternalLogin action method?
I don't get in this case how to put a checkbox on the LoginView page and wire things up so that I can process it in the ExternalLogin action method. How can I accomplish this?
Don't delete any code, just change as follows:
In AccountViewModels, edit to match:
In Account Controller, edit to match:
In Login view, edit to match:
In Login view, add this:
In _ExternalLoginListPartial:
Check out the
AccountController.ExternalLoginConfirmation
action and note the call toawait SignInHelper.SignInAsync(user, isPersistent: false, rememberBrowser: false)
. You can set those values to true, or you can update theExternalLoginConfirmationViewModel
and correspondingExternalLoginConfirmation
view to let the user decide.BTW:
isPersistent
will persist the users session across closing and reopening their browser. TherememberBrowser
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