How to set up two-factor authentication with ASP.net Identity 2.0? -
How to set up two-factor authentication with ASP.net Identity 2.0? -
so must missing super simple or i'm not understanding how two-factor authentication supposed work asp.net identity 2.0.
my understanding two-factor authentication supposed work godaddy or google; when effort log in computer without valid sec factor cookie, email or sms sent auth code , presented sec form come in auth code in order finish sign in process.
all of code appears nowadays in new mvc 5 project, except had implement sendasync function email service:
public class emailservice : iidentitymessageservice { public task sendasync(identitymessage message) { // plug in email service here send email. smtpclient smtpclient = new smtpclient("127.0.0.1", 25); mailmessage mail service = new mailmessage("sender@domain.com", message.destination, message.subject, message.body); smtpclient.send(mail); homecoming task.fromresult(0); } }
however, when log in, no email sent , no auth code form displayed.
i went in manage view (views => manage => index) , uncommented twofactor section. logged in, went manage screen, , enabled two-factor authentication account, didn't create bit of difference.
thoughts on missing?
edit
ok, appears crux of problem may related registration confirmation. 2 factor authentication appears work when email has been confirmed. otherwise code not send. either need enable email confirmation in registration, or set emailconfirmed = true
when register user.
the issue email has marked confirmed two-factor authentication work.
asp.net asp.net-mvc asp.net-identity
Comments
Post a Comment