Ajax REST call is ignoring Basic Auth
-
Hello all,
I am trying to make a REST call (which requires authorization) to WordPress from an external site. I read the documentation and installed the required plugin for Basic Auth to work.
When making a request through Postman it is working just fine. But when making the Ajax request (jQuery) from my external site it seems like the request is always trying to use the WordPress cookie instead of Basic Authentication or it is trying to make the request without any authorization at all. I am always getting a 401 error.
I tried many ways to set the authorization information and none of them worked so far: beforeSend, headers field, … It just gets ignored, even putting invalid credentials doesn’t affect anything. Checking on the request in Chrome Dev Tools reveals that the Authorization Header is set in the request headers.
What do I have to do to make a REST call (I am trying to add a comment to a post) from an external site? I am grateful for any insights!
- The topic ‘Ajax REST call is ignoring Basic Auth’ is closed to new replies.