• Having a strange thing occurring lately and don’t think it’s related to the plugin but either an update to WordPress or cURL on the server or something else…

    Recently, I’m getting the follow error when using Swagger UI to perform test calls:

    
    {
      "code": "rest_forbidden_context",
      "message": "Sorry, you are not authorized to view this content.",
      "data": {
        "status": 401
      }
    }
    

    But only when testing via the documentation page; If I copy/paste the cURL command directly in the server, or make the actual remote api request via Postman or Insomnia there are no issues… The authentication parameters look correct, it just appears that it’s being rejected for some reason…. not exactly sure why… figured I post the question here in case anyone can shed some light.

    Thanks!

    • This topic was modified 3 years, 1 month ago by ouija.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ouija

    (@ouija)

    Update: Upon further investigation, the issue seems to be that IF I am logged into WordPress, I cannot access the rest api without a 401 error (which is odd); If I don’t have a session set (not logged in), then it works…

    Strange.. I _think_ this might have something to do with WordPress 5.6 rolling out integrated support for “Application Passwords” versus WooCommerce REST API tokens, and for whatever reason, when you are *logged in* and trying to use a WooCommerce based token for accessing the API, it doesn’t work… (but it does if you are NOT logged in)

    It’s a stupid thing… still trying to figure out what the heck is going on with it..

    • This reply was modified 3 years, 1 month ago by ouija.
    Thread Starter ouija

    (@ouija)

    Figured out the issue — for some reason, the X-WP-Nonce header is NOT being set properly when using performing test calls using the SwaggerUI interface with a user logged in to WordPress…

    Not sure what is causing this to happen now, as previously this issue did not exist, but this appears to be what is causing the problem.

    Will post back if I can figure out a solution to this.

    • This reply was modified 3 years, 1 month ago by ouija.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘401 Error’ is closed to new replies.