1 min read 2 wks ago

You Don’t Have Permission To Do This

When a request is sent to AI Engine through your WordPress REST API, AI Engine reads the X-WP-Nonce of the request and checks it with the wp_verify_nonce WordPress function. If the request is refused (401 or 403), it means that the nonce wasn’t valid. This is usually due to how cookies and cache are handled on your site: most often, a cached page served to a logged-in user, or an optimization or security plugin. Try to disable your other plugins one by one to find the one that affects this behavior. The Cookie Check Failure page lists what to exclude from your cache.

If you need further assistance, your hosting provider’s support might be more inclined to help understand why your nonce value wouldn’t be valid.

You can use the mwai_rest_authorized filter to bypass the nonce check (even though you would definitely prefer to fix the cache issue rather than overriding this). An example is on the Cookie Check Failure page.