Accessing private posts through REST API, same code that works in remote doesn’t in local

Question

I am capable of fetching private posts through the wp rest api by calling

mydomain/wp-json/wp/v2/posts?status=private&slug=whatever

I am authenticating well and receiving a valid token, no problems

But with the same site running with Laragon (windows 10), while running ok with the authentication, I cannot retrieve the private posts

http://testing.test/wp-json/wp/v2/posts?status=private&slug=whatever

{
    "code": "rest_invalid_param",
    "message": "Invalid parameter(s): status",
    "data": {
        "status": 400,
        "params": {
            "status": "Status is forbidden."
        }
    }
}

I’m getting the same response (as expected) when using Postman and having the Bearer token header correctly configured

What’s going on? I’ve run out of ideas

*I can retrieve public posts

0
, , , , GWorking 2 years 2020-01-10T08:39:12-05:00 0 Answers 102 views 0

Leave an answer

Browse
Browse