Authentication providers: no token_bearer I created a custom resource for a Drupal 8 REST call. For some reason, I can't see either basic_auth or token_bearer from the authentication providers. I installed simple_oauth and still can't see either basic_auth or token_bearer. 


  


The code I am using is the following one.

config/install/rest.resource.sample_index_resource.yml

id: sample_index_resource
plugin_id: sample_index_resource
granularity: resource
configuration:
GET:
  supported_formats:
    - json
  supported_auth:
    - basic_auth
    - cookie
    - token_bearer


src/Plugin/rest/resource/SampleResource.php

/**
 * Provides a Sample Index Resource
 *
 * @RestResource(
 *   id = "sample_index_resource",
 *   label = @Translation("Sample Index Resource"),
 *   uri_paths = {
 *     "canonical" = "/api/sample-response/{category}/{alias}"
 *   }
 * )
 */
class SampleResource extends ResourceBase {
/**
* Responds to entity GET requests.
* @return \Drupal\rest\ResourceResponse
*/
public function get($category, $alias) {
  // Return response
}


The HTTP Basic Authentication module needs to be enabled to be able to use basic_auth as authentication provider. I don't know which module I should enable to be able to use token_bearer.

What module do I need to install to get token_bearer as authentication provider?
I think your yml syntax is wrong (or out-dated) look at rest.resource.entity.node.yml for a correct example.
Or use the "REST UI" module to specify your resources.

It should look more like:

configuration:
  methods:
    - GET
    - POST
    - PATCH
    - DELETE
  formats:
    - hal_json
  authentication:
    - basic_auth