The security validation for this page is invalid and might be corrupted error in SharePoint Rest API

This SharePoint tutorial explains how to solve error Microsoft.SharePoint.SPException. The security validation for this page is invalid and might have corrupted. Please your browser’s back button to try your operation again. status 403, FORBIDDEN.

Recently while I was trying to create a group by using Rest API in SharePoint 2013, I got the following error message. Microsoft.SharePoint.SPException. The security validation for this page is invalid and might have corrupted. Please your browser’s back button to try your operation again. status 403, FORBIDDEN. The error can come in SharePoint 2013/2016 or SharePoint Online.

The error was coming like below:

The security validation for this page is invalid and might be corrupted
The security validation for this page is invalid and might be corrupted

This error usually comes when you any POST Rest API call.

The security validation for this page is invalid and might be corrupted rest SharePoint

Add the “X-RequestDigest” header, with the value of the hidden input field “__REQUESTDIGEST” which is the form digest value. Like below:

headers: {
"Accept": "application/json; odata=verbose",
"X-RequestDigest": $('#__REQUESTDIGEST').val()
}

Once you add “X-RequestDigest”: $(‘#__REQUESTDIGEST’).val(), then the error the security validation for this page is invalid and might be corrupted rest SharePoint will not appear.

You may like the following tutorials:

  • >