Module Description
A Services authentication provider that adds API-key access to an endpoint. Allows user selection for performing endpoint tasks.
1) Configure a user role: URL: admin/structure/services/api_key_settings Use this page to configure which user role should be used to display available users in the authentication configuration screen for an endpoint
2) Configure the API Key authentication settings for an endpoint When setting up a new endpoint make sure the API Key Authentication option is checked under Authentication. Then edit the authentication settings, entering the API Key and selecting a user. Setting a user will mean that any requests to the endpoint with a valid API Key will perform all its actions as that user with the permissions defined for their role.
3) Making a request to the endpoint with a key The module will look for either a request parameter or header (depending on how the module was configured) called api-key and look to compare this value against the key defined for the endpoint. Any requests without this value or with an invalid value will be blocked.
Related Modules
Services API Keys Authentication: This module allows keys to be generated on a per-user basis, unlike this module which currently supports only one key per endpoint. However, we're open to adding support for multiple keys per endpoint. Please contribute to #2195767: Support for multiple API keys if interested.
Drupal 8/9
This module will also be the home for using an API key in Drupal 8, although Services is not required as it is no longer necessary. Track progress in #2869068: Drupal 8 release. Help is always appreciated.
1) Configure a user role: URL: admin/structure/services/api_key_settings Use this page to configure which user role should be used to display available users in the authentication configuration screen for an endpoint
2) Configure the API Key authentication settings for an endpoint When setting up a new endpoint make sure the API Key Authentication option is checked under Authentication. Then edit the authentication settings, entering the API Key and selecting a user. Setting a user will mean that any requests to the endpoint with a valid API Key will perform all its actions as that user with the permissions defined for their role.
3) Making a request to the endpoint with a key The module will look for either a request parameter or header (depending on how the module was configured) called api-key and look to compare this value against the key defined for the endpoint. Any requests without this value or with an invalid value will be blocked.
Related Modules
Services API Keys Authentication: This module allows keys to be generated on a per-user basis, unlike this module which currently supports only one key per endpoint. However, we're open to adding support for multiple keys per endpoint. Please contribute to #2195767: Support for multiple API keys if interested.
Drupal 8/9
This module will also be the home for using an API key in Drupal 8, although Services is not required as it is no longer necessary. Track progress in #2869068: Drupal 8 release. Help is always appreciated.
Module Link
Project Usage
1473
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
This module aims to solve the issue of adding API-key access to an endpoint and allowing user selection for performing endpoint tasks.
Data Name
services_api_key_auth