authentication
When communicating with a third-party API, you'll most likely need to attach an API token to access the resource. Using this field, you'll be able to require a token input before the interface gets loaded.
Authentication tokens need to be identified by a string of your choice. Authentication tokens are project-scoped, so multiple interfaces can require the same token (and only be entered & saved once).
To use the API token, specify the same key in the authentication_key
field of a Request. The specified headers will be appended to the request.
const config = {
key: ...,
fields: ...,
access: ...,
authentication: {
// This is a project-scoped key, the name is your choice
// Any interfaces within the same project can refer to the same key
"my-api-access-key-name": {
type: "token",
// These headers will be appended to any request that refers to this key
headers: {
authentication: "Bearer {token}"
},
// Customize the modal that is displayed when prompting the user to enter the authentication token
interface: {
title: "Enter API Token",
label: "API Token",
placeholder: "abc123",
description: "This can be some small info for the user",
instructions_link: "https://example.com/api-access-instructions"
}
}
},
requests: {
get: {
uri: "https://example.com",
http_method: "GET",
// This key should match the key above
authentication_key: "my-api-access-key-name"
}
}
};
type
Type | Required | Default |
---|---|---|
string | Yes | undefined |
Determines the type of authentication being used.
token
: An API token that is a single string value.
More options on the roadmap.
headers
Type | Required | Default |
---|---|---|
Object | No | undefined |
Headers object to append to the request. In this object, you can refer to the value of your API token as {token}
.
interface
Type | Required | Default |
---|---|---|
object | No | undefined |
Options to customize the modal that prompts users to input their API token.
Interface Properties
title
- Modal titlelabel
- Input labelplaceholder
- Input placeholderdescription
- Modal descriptioninstructions_link
- Link for additional instructions