WP-API / Basic-Auth

Basic Authentication handler for the JSON API, used for development and debugging purposes
761 stars 281 forks source link

Basic does not show up as a valid authentication method (or work) #36

Open birds-inc opened 8 years ago

birds-inc commented 8 years ago

I've installed and activated WP-API (v2) and Basic-Auth plugin, however, "Basic" does not appear in the list of authentication methods when querying /wp-json.

...
  "namespaces": [
    "wp/v2",
    "oembed/1.0"
  ],
  "authentication": [],
  "routes": {
    "/": {
...

If I install the OAuth plugin, the method does appear:

...
  "namespaces": [
    "wp/v2",
    "oembed/1.0"
  ],
  "authentication": {
    "oauth1": {
      "request": "http://www.crucibleradio.com/oauth1/request",
      "authorize": "http://www.crucibleradio.com/oauth1/authorize",
      "access": "http://www.crucibleradio.com/oauth1/access",
      "version": "0.1"
    }
  },
  "routes": {
    "/": {
...

For any request I make using the Basic authentication method, I get a permissions error:

{
  "code": "rest_cannot_edit",
  "message": "Sorry, you are not allowed to update this post.",
  "data": {
    "status": 401
  }
}

What causes an authentication method to become "registered" with WP-API and show up in that list? Does "Basic" appear as an item in the authentication methods in a working installation?

wblaircox commented 8 years ago

+1

HeikoBornholdt commented 8 years ago

+1

adam-marash commented 5 years ago

This might help someone coming across this ticket:

As a user with a working installation, I can confirm that "Basic" does NOT appear as an item in the listed authentication methods:

...
"namespaces": [
   "oembed/1.0",
   "2fa/v1",
   "wp-rest-api-log",
   "acf/v3",
   "wp/v2"
],
"authentication": [],
"routes": {
   "/": {
      "namespace": "",
      "methods": [
         "GET"
      ],
"endpoints": 
...