diff --git a/src/Altinn.App.Api/Controllers/HomeController.cs b/src/Altinn.App.Api/Controllers/HomeController.cs index d1b34489e..33cd738c7 100644 --- a/src/Altinn.App.Api/Controllers/HomeController.cs +++ b/src/Altinn.App.Api/Controllers/HomeController.cs @@ -74,6 +74,20 @@ public async Task Index( [FromQuery] bool dontChooseReportee ) { + // See comments in the configuration of Antiforgery in MvcConfiguration.cs. + var tokens = _antiforgery.GetAndStoreTokens(HttpContext); + if (tokens.RequestToken != null) + { + HttpContext.Response.Cookies.Append( + "XSRF-TOKEN", + tokens.RequestToken, + new CookieOptions + { + HttpOnly = false, // Make this cookie readable by Javascript. + } + ); + } + if (await ShouldShowAppView()) { ViewBag.org = org;