DpapiDataProtectionProvider - Windows Azure : The data protection operation was unsuccessful.

May 24, 2014 at 1:36 PM
Edited May 24, 2014 at 1:40 PM
Hi,

When I try to use Identity 2.0 on windows azure I get this error :
The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating.
It happen when it reach this line of code :
await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
And I do something like that with UserManager constructor (I use unity IOC and not Owin helper to instanciate datacontext) :
public AppUserManager(IUserStore<AppUser, string> store):base(store)
        {
            var manager = this;
            var dataProtectionProvider = new Microsoft.Owin.Security.DataProtection.DpapiDataProtectionProvider("AppName");
            manager.UserTokenProvider = new Microsoft.AspNet.Identity.Owin.DataProtectorTokenProvider<AppUser>(dataProtectionProvider.Create("PR"));

........
}
Any idea of why I get that ?
May 24, 2014 at 2:47 PM
Edited May 24, 2014 at 4:35 PM
.
May 30, 2014 at 12:46 PM
I have the same problem. I use Azrue Sites. need help thanks
May 30, 2014 at 1:53 PM
Edited May 30, 2014 at 1:55 PM
What it your code to instantiate the DataProtectionProvider ? And do you use an IOC ?
Jun 16, 2014 at 1:34 AM
I run into the same issue. Replacing token provider with a simple one: EmailTokenProvider fixed the problem:
UserTokenProvider = new EmailTokenProvider<ApplicationUser, string>();