API Key Based Authentication
To support invoking of REST APIs secured with an API key, use the API Key Based Authentication
managed security policy.
Overview
To add the API Key Based Authentication policy to your document, use the available authentication scheme template. See Implement a New Connection Definition.
You can customize the security policy as needed for a connection definition.
Security Properties
A connection definition that uses this
security policy defines the following properties in the
securityProperties
section. See Connection Properties and Sample Code.
The values in the name
,
displayName
,
shortDescription
, and
description
columns list the default values
that appear when you insert a security policy into an adapter
definition document. You can update these values if needed.
name | displayName | shortDescription | description | Data type | Required |
---|---|---|---|---|---|
|
|
|
|
Password |
Yes |
|
|
|
|
Text |
No |
Sample Code: API Key Based Authentication
The following code sample shows how to define the security policy in a connection using API key based authentication.
"securityPolicies": [
{
"type": "managed",
"policy": "API_KEY_AUTHENTICATION",
"description": "API Key Based Authentication",
"displayName": "API Key Based Authentication",
"scope": "ACTION",
"securityProperties": [
{
"name": "accessToken",
"displayName": "API Key",
"description": "Provide the API Key",
"shortDescription": "Example: <The generated api key>",
"hidden": false,
"required": true
},
{
"name": "accessTokenUsage",
"hidden": true,
"required": true,
"default": "-H Authorization: Bearer ${api-key}"
}
]
}
]