- Issue created by @timfletcher
Accessing a Gatsby endpoint via an api token returns a 403
error, as authenticated access is only permitted via basic_auth
or cookies:
gatsby_endpoints.gatsby_endpoints_controller_sync:
path: '/gatsby/{endpoint_id}'
defaults:
_controller: '\Drupal\gatsby_endpoints\Controller\GatsbyEndpointController::sync'
_title: 'Gatsby Endpoint'
options:
_auth: ['basic_auth', 'cookie']
1. Install the gatsby_endpoints
module and configure permissions on a fresh Drupal website
2. Install the key_auth
module
3. In your Gatsby project, install the gatsby-source-drupal
plugin
4. In gatsby-config.js
file, add the options.params.api-key
value of your Drupal user's API key
5. Create a Gatsby endpoint
6. Attempt to access it using your API token e.g. mysite.com/gatsby/my-endpoint?api-key=123
Add support for key_auth
in gatsby_endpoints.routing.yml
:
_auth: ['basic_auth', 'cookie', 'key_auth']
Active
Code