When ever I add the line below to my Startup class I get the exception below. This is a self hosted exe running from mono (Ubuntu). It works fine in windows. I\'ve narrowed it d
Okay this is happening because OWIN uses DpapiDataProtector by default and DPAPI is a windows API (Data Protection API) and does not work in mono. Luckily you can override the default in your cookie options. Below is an example where AesDataProtectorProvider is a custom IDataProtector that I found here: Using Oauth tickets across several services?
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
TicketDataFormat =
new SecureDataFormat<AuthenticationTicket>(DataSerializers.Ticket,
new AesDataProtectorProvider("testing"), TextEncodings.Base64)
});
With this code my project starts in Mono again.
UPDATE:
You can also have a custom IDataProtectionProvider and have all of owin use that with this:
app.SetDataProtectionProvider(new CustomIDataProtectionProvider());