Installation
Before requiring the custom module, ensure that the necessary private repository is configured in your Composer setup. This is a prerequisite for Composer to locate and download the module package. To do this, add the repository to yourcomposer.json
configuration using the appropriate command or by editing the file directly.
Configuration Management
The opigno connect provides a user interface or configuration forms to simplify the setup of OAuth2 client credentials specific to your integration needs. This could involve:- Allow administrators to input the Client ID and Client Secret for the Backoffice.
- Providing options to configure the scope required for your custom integrations.
- Integrating with Drupal’s Key module to securely store these sensitive credentials (as recommended)
Using Opigno Connect Services
Opigno Connect provides a set of core services to handle the OAuth2 authentication flow and facilitate secure communication with the Backoffice.1. Authentication and Token Management
OpignoConnector
Service
This service initiates the OAuth2 flow and is responsible for obtaining access tokens using the configured client credentials.generateAuthToken()
Function
A utility function offered by Opigno Connect that can be used programmatically to retrieve access tokens when needed.
2. API Request Authorization
-
ClientFactory
When making API requests to the Backoffice, the access token is automatically included in theAuthorization
header using the Bearer scheme: -
Acting on Behalf of Specific Users
To perform actions in the context of a specific user, theOpinion-Client-UUID
header must be added to API requests. This header identifies the user on whose behalf the request is made: