Cookie Check Failed When Opening a Private File
If you click a file or signature link in an email sent by WS Form, you may see the following error:
{"code":"rest_cookie_invalid_nonce","message":"Cookie check failed","data":{"status":403}}
This error can occur when the file upload or signature field is configured to use WS Form (Private).
Why Does This Happen?
Files saved using WS Form (Private) are protected and are not publicly accessible.
When WS Form generates a link to a private file, WordPress includes a security token called a nonce. This token is used to verify the user and their login session when the file is accessed.
These links are primarily intended for use within WS Form > Submissions, where authorized users can securely access uploaded files.
When a private file link is included in an email, it may not work because:
- The link is opened by a different user. The recipient is not the same WordPress user whose session was used to generate the link.
- The user has logged out or logged back in. The original login session is no longer valid.
- The link has expired. WordPress security tokens typically remain valid for 12 to 24 hours.
- The recipient is not logged in. The browser cannot validate a token associated with a logged-in user.
This can also happen when a form is submitted by a visitor who is not logged in. If an administrator subsequently opens the private file link from an email, the security token may not match their logged-in session.
The error is generated by WordPress, which rejects the request before WS Form can process the download.
How to Resolve the Error
The appropriate solution depends on who needs access to the uploaded file.
Option 1: Access the File Through WS Form Submissions
If the file needs to remain private, this is the recommended approach.
- Log in to WordPress with an account that has permission to view WS Form submissions.
- Navigate to WS Form > Submissions.
- Open the relevant submission.
- Click the file or signature link to view or download it.
WS Form generates a fresh, authorized link when you access the file through the submissions screen.
Avoid relying on private file links included in emails, as these may expire or fail when opened by another user.
Option 2: Use a Public File URL for Email Links
If email recipients need to access uploaded files directly, consider changing the field’s Save To setting.
The following storage options provide URLs that do not rely on the recipient’s WordPress login session:
- WS Form (Public): Saves the file in a publicly accessible location within the WordPress uploads directory.
- Media Library: Saves the file as a WordPress media attachment with a URL that can be included in emails.
These options are better suited to situations where recipients need to open uploaded files from email notifications, including after several days.
Important: Files saved using these methods are generally accessible to anyone who has the file URL. Do not use these options for sensitive or confidential uploads unless additional access controls are in place.
What If I See “Sorry, You Are Not Allowed to Do That”?
You may occasionally see a different error:
{"code":"rest_forbidden","message":"Sorry, you are not allowed to do that.","data":{"status":403}}
This means the request has passed the applicable WordPress authentication checks, but the user does not have permission to access the private file.
Private file downloads require the read_submission capability, which is normally available to WordPress administrators.
To access the file, log in with an account that has the required permissions and open it through WS Form > Submissions.
Which Storage Option Should I Use?
| Save To Setting | Best For | Email File Links |
|---|---|---|
| WS Form (Private) | Sensitive uploads that should only be accessible to authorized users | Not recommended |
| WS Form (Public) | Files that recipients need to access directly | Supported |
| Media Library | Files that should be stored as WordPress media attachments | Supported, subject to any additional access restrictions |
Our recommendation: Use WS Form (Private) when uploaded files need to remain protected, and access those files through WS Form > Submissions.
If recipients need to open files directly from an email, use WS Form (Public) or Media Library, provided the files are suitable for public access.