passwords - Asp.net Identity DataProtectorTokenProvider Tokenlife span not working -


asp.net identity dataprotectortokenprovider tokenlife span not working, expiring automatically after 1 hour if specify tokenlifespan 2hours

 var provider = startup.dataprotectionprovider;             _usermanager.usertokenprovider = new dataprotectortokenprovider<identityuser>(provider.create("accountactivation"))             { tokenlifespan = timespan.fromhours(2) };              var emailconfirmtoken = await _usermanager.generateemailconfirmationtokenasync(userid);              var passwordresettoken = await _usermanager.generatepasswordresettokenasync(userid);              string callbackurl = string.format(appsettings.applicationurl, "reset-password") +                                 "?userid=" + userid +                                 "&email=" + email +                                 "&emailtoken=" + emailconfirmtoken +                                 "&resettoken=" + passwordresettoken; 

i used code above generate token 2 hours expiration.

 public async task<bool> confirmemail(string userid, string token, string email)     {         identityuser user = await _usermanager.findbyidasync(userid);          if (user == null)             return false;              var provider = startup.dataprotectionprovider;              _usermanager.usertokenprovider = new dataprotectortokenprovider<identityuser>(provider.create("accountactivation"))             { tokenlifespan = timespan.fromhours(2) };              bool tokencheck = _usermanager.verifyusertoken(userid, "accountactivation", token);              var result = await _usermanager.confirmemailasync(userid, token); } } 

here above code used confirm token, working before 1 hour, after 1 hour getting result "invalid token "


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -

What is happening when Matlab is starting a "parallel pool"? -