Test Account
To test your connector, you can define a testAccount top-level property in the configuration file. The information
provided in this section will be sent to the X-Unito-Credentials header of your connector.
Custom Authorization method
For example, if your connector has the following configuration using a custom authorization method;
{
"authorizations": [
{
"name": "apiKey",
"method": "custom",
"variables": {
"apiKey": {
"type": "password",
"required": true,
"label": "Your API key"
}
}
}
]
}
You could define the following test account;
{
"testAccount": {
"apiKey": "<your test api key>"
}
}
Note: Here the 'apiKey' field is not named randomly, it matches the variable defined in the Authorization above.
Oauth2 Authorization method
Here is another example for a connector using the following configuration with a oauth2 authorization method;
{
"authorizations": [
{
"name": "oauth2",
"method": "oauth2",
"variables": {
"workspace": {
"type": "string",
"label": "Your workspace"
}
}
"oauth2": {
"clientSecret": "<obtained from the provider>",
"clientId": "<obtained from the provider>",
"authorizationUrl": "<obtained from the provider>",
"grantType": "authorization_code",
"tokenUrl": "<obtained from the provider>"
"scopes": [{ "name": "<obtained from the provider>", "help": "<description of the scope>" }]
}
}
]
}
You could define the following test account;
{
"testAccount": {
"accessToken": "<test account access token>", // When using oauth2 method, we always look for 'accessToken'
"workspace": "<test account workspace>" // And the other variables needed, as defined in the Authorization
}
}
Sensitive field encryption
If you need to keep some test account information secret for any reasons (e.g maybe you are using your own tiktok
account apiKey), you can encrypt the sensitive values individually using the CLI
encrypt command, use them in your configuration file and the Debugger will take care of
decrypting it at runtime.
To use this feature, you must deploy your integration once with the publish command.
{
...,
"testAccount": {
// Encrypted value retrieved with the `integration-cli encrypt` command
// Starts with 'unito-secret-vX://'
"apiKey": "unito-secret-v1://encrypted-secret",
"otherValue": "Blue font"
}
}
The testAccount is what the CLI uses to run the integration locally (integration-cli dev, integration-cli test)
and to drive compliance tests in CI.