WordPress Development Asked on November 6, 2021
I’m trying to fetch preview data through WP Rest API using a url such as /wp-json/wp/v2/pages/1140/revisions/1653
.
An extra header is also included: 'X-WP-Nonce': <nonce>
– nonce comes from WP.
Why am I getting 401 unauth error? Thanks
{ code: 'rest_cannot_read',
2020-07-21T11:45:35.930292+00:00 app[web.1]: message: 'Sorry, you are not allowed to view revisions of this post.',
2020-07-21T11:45:35.930293+00:00 app[web.1]: data: { status: 401 } }
The solution was to generate and use an API token.
username:key
'Authorization': 'Basic <base64 token here>'
In my case, the key was deleted.
Answered by haxpanel on November 6, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP