Connection Credentials Storage
Connection Credentials Storage
By default, Membrane stores connection credentials in the database.
If configured, it allows storing those credentials in an external API.
Configuration
Database (default)
No configuration required. By default this is the storage used (default value: database).
External API
You need to set 2 environment variables:
CONNECTION_CREDENTIALS_STORAGE_TYPEtoexternal_apiCONNECTION_CREDENTIALS_EXTERNAL_API_ENDPOINT_URLto the designated endpoint, using REST API for reading and saving connection credentials.
All communication (saving and reading credentials) will pass X-Membrane-Token header with your token.
Saving credentials
Endpoint URL will contain connectionId query parameter (added by Membrane), as connection identifier. Body payload will contain credentials to store.
PUT: https://api.yourendpointurl.com?connectionId={CONNECTION_ID}Hint: URL can contain any other query parameters, or path. connectionId parameter will be added to the URL.
Payload:
{
  "credentials": "YOUR_CREDENTIALS"
}Where:
CONNECTION_IDis the ID of the connection you wish to store the credentials forYOUR_CREDENTIALSis any valid JSON value. Can be a string, object, whatever is used for credentials for given connection, e.g.:{ "accessToken": "test-access-token", "refreshToken": "test-refresh-token", "expiresAt": "2024-12-31T23:59:59Z" }
Expected responses:
201 Createdwhen save was successful- non 
2xxwhen save was unsuccessful 
Reading credentials
Endpoint URL will will contain credentialsId query parameter, as connection identifier:
GET: https://api.yourendpointurl.com?connectionId={CONNECTION_ID}Hint: URL can contain any other query parameters or path. connectionId parameter will be added to the URL.
Expected responses:
200 OKwith body{ "credentials": "YOUR_CREDENTIALS" }404 NOT FOUNDwhen credentials were not found
Where:
CONNECTION_IDis the ID of the connection you wish to get the credentials forYOUR_CREDENTIALScontains previously stored credentials, e.g.:{ "accessToken": "test-access-token", "refreshToken": "test-refresh-token", "expiresAt": "2024-12-31T23:59:59Z" }
Updated 10 days ago
