3

We are using Sitecore 9.0.1 and Marketing Automation heavily on our current small project.

On one of our environments, we are getting

Authorization has been denied for this request.

when we are trying to create or update Marketing automation campaigns.

By latest testing this is happening only in Chrome 64.0.3282.186 (Official Build) (64-bit). On Firefox 58.0.2 (64-bit) everything is working as expected.

  1. First popup is opened which is weird:

Popup is opened which is weird

  1. And then exception is shown: Exception

I can see that request to {sitename}/sitecore/api/ma/plans/?cultureName=en is made when hitting "Save" button but ends with HTTP 403 Status Code.

HTTP 403 Status Code

This is the response:

{"message":"An error has occurred.","exceptionMessage":"The required anti-forgery cookie \u0022__RequestVerificationToken\u0022 is not present.","exceptionType":"System.Web.Mvc.HttpAntiForgeryException","stackTrace":" at System.Web.Helpers.AntiXsrf.TokenValidator.ValidateTokens(HttpContextBase httpContext, IIdentity identity, AntiForgeryToken sessionToken, AntiForgeryToken fieldToken)\r\n at System.Web.Helpers.AntiXsrf.AntiForgeryWorker.Validate(HttpContextBase httpContext, String cookieToken, String formToken)\r\n at Sitecore.Web.Http.Filters.ValidateHttpAntiForgeryTokenAttribute.OnAuthorization(HttpActionContext actionContext)"}

When I open {sitename}/sitecore/api/ma/plans/?cultureName=en in new tab, I can see results without any problem:

Normal results in new tab

Has anyone experienced same behaviour? How can we fix this? We can see nothing extraordinary in logs.

4
  • Out of curiosity, can you try to delete all your cookies in your browser and try again? The "Required Anti-Forgery Cookie" error is sometimes caused by a bad cookie. Having said that... I also have seen this error message pop up when there's a different underlying error. Sometimes that underlying error is only shown in the logs. Long story short.. it's either a client issue with your cookies.. or there's another error hidden behind the forgery error.
    – Pete Navarra
    Mar 14, 2018 at 14:04
  • 1
    @PeteNavarra - Very good comment Pete but did not helped at least on Chrome. I have tried the same on Firefox and it's working. On Chrome, it is still not working. Mar 14, 2018 at 14:21
  • At least we have workaround for now Mar 14, 2018 at 14:21
  • Will create ticket to Sitecore Support to check with them Mar 14, 2018 at 14:25

1 Answer 1

3

There are generally two reasons why one would get the Required Anti-Forgery Cookie error message.

  1. There is a client issue with your browser preventing the cookies from being read correctly.
  2. The error message shown is actually a red herring, and there's an underlying error occurring. You will generally have to look through log files to find the underlying issue.

The majority of the time, it's due to the client browser. Clearing cookies at the domain level and reloading the page can generally fix this issue. This is most notably the issue when going into Experience Analytics and none of the graphs load.

You can also try a different browser and see if you are presented with the same error. Generally, a different browser will work. A recent update with Chrome has raised some minor issues with XHR requests resulting in this error message.

2
  • 1
    We had encountered issues also in Experience Analytics as you described. For now workaround is to use Firefox for us instead of Chrome :) Mar 14, 2018 at 14:44
  • I had that exact error today. Flushing my browser cookies for that domain fixed the issue on Chrome. Sep 19, 2019 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.