I using a kubernetes StatefulSet for a hangfire pod in gke kubernetes. It is working perfectly except when I make a replication. I get this exception due the Antiforgery token validation:
Microsoft.AspNetCore.Antiforgery.Internal.DefaultAntiforgery[7] An exception was thrown while deserializing the token. Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The antiforgery token could not be decrypted. ---> System.Security.Cryptography.CryptographicException: The key {9f4f1619-10ff-4283-a529-eb48a0799815} was not found in the key ring.
Is there any solution please ?
The response is to Persist DataProtection key to redis
var redis = ConnectionMultiplexer.Connect("localhost,password=password");
services.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys");