Kubernetes + Redis: The antiforgery token could not be decrypted Kubernetes + Redis: The antiforgery token could not be decrypted kubernetes kubernetes

Kubernetes + Redis: The antiforgery token could not be decrypted


According to the documentation in the below article the application name needs to be set.

services.AddDataProtection()    .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys")    .SetApplicationName("product");

By default, the Data Protection system isolates apps from one another based on their content root paths, even if they're sharing the same physical key repository. This prevents the apps from understanding each other's protected payloads.

To share protected payloads among apps:

  • Configure SetApplicationName in each app with the same value.

https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/configuration/overview?view=aspnetcore-3.0

Just a further note on this. If you get a 400 Bad Request and are using an API in the same solution then I would suggest having a look at the IgnoreAntiforgeryToken Attribute to decorate methods where CSRF does not apply.

[HttpPost][IgnoreAntiforgeryToken]