i have 2 web applications, wcf , mvc share same database. using aspnet identity 2.0
while registering new user, creates confirmation token , sends email user. creating token, sending email done in wcf, verification done in mvc application.
var code = usermanager.generateemailconfirmationtoken(user.id); string.format("{0}/account/confirmemail?userid={1}&code={2}", websiteurl, httputility.urlencode(user.id), httputility.urlencode(codeid));
i using same data protection provider
in wcf
var provider = new microsoft.owin.security.dataprotection.dpapidataprotectionprovider("mytestapplication"); usermanager.usertokenprovider = new microsoft.aspnet.identity.owin.dataprotectortokenprovider<applicationuser>( provider.create("usertoken")) { tokenlifespan = timespan.fromdays(7) };
in mvc
var dataprotectionprovider = new microsoft.owin.security.dataprotection.dpapidataprotectionprovider("mytestapplication"); manager.usertokenprovider = new dataprotectortokenprovider<applicationuser>(dataprotectionprovider.create("usertoken")) { tokenlifespan = timespan.fromdays(7) }; }
source : make asp.net identity 2.0 email confirm token work wcf , mvc
now problem
works fine in localhost , qa. tested ok on ssl in localhost too.
fails on production (uses ssl). generating token wcf , validating in mvc fails.
- generating , validating in same application works.
how invalid token
error occuring? has web.config
it?
found problem.
it application pools in iis. using different application pool wcf , mvc application. put in same application pool , working fine.
additional info: having same problem , solution doesn't fix problem might want try machinekey
.
http://gunaatita.com/blog/invalid-token-error-on-email-confirmation-in-aspnet-identity/1056
ps. find answer myself after post on stackoverflow. thank you.
Comments
Post a Comment