I have a project project (WCF) and MVC that uses the same database to process the service part for the Mobile and Interface part. I have to set up an email confirmation for both.
I used the OWIN ASP.NET 2.0 library for authentication, and both projects have separate UserManagers.
For MVC
public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context) { var dataProtectionProvider = options.DataProtectionProvider; if (dataProtectionProvider != null) { manager.UserTokenProvider = new DataProtectorTokenProvider<ApplicationUser>dataProtectionProvider.Create("ASP.NET")); } }
For WCF
var provider = new Microsoft.Owin.Security.DataProtection.DpapiDataProtectionProvider("ASP.NET"); UserManager.UserTokenProvider =new Microsoft.AspNet.Identity.Owin.DataProtectorTokenProvider<ApplicationUser>( provider.Create("EmailConfirm")); var code = idManager.UserManager.GenerateEmailConfirmationToken(appuser.Id);
Problem The email confirmation token generated in MVC works fine.
In WCF, when I create an email confirmation token, it must be verified from the MVC website. Here he gives me an "Invalid token."
I think this is due to the fact that the token codes do not match, I tried to make them the same as I can, but I donβt really know which one is between Wcf and MVC.
by the way. I am testing on localhost from Visual studio.
source share