Make.com Custom App Connections: API Keys, OAuth and the 401
In this video
This is the written version of Level 3 of Build your own Make app. Your key is right. You copied it twice. And Make still says 401.
This guide is about connections, the part of your app where your customer logs in. By the end, you'll have one that tests the key the moment it's saved, shows whose account it is, and never leaks the key into a log. And you'll know why a correct key gets a 401: most of the time, it isn't the key's fault.
This follows Level 2, where we built the app, its base and a first module. The example API, Acme CRM, is invented; put your own API in its place.
What a connection is
A connection is the dialog your customer sees the first time they use your app. They paste a key, or click through an OAuth screen, and Make keeps it for every scenario after that.
Make's docs list these kinds:
- Basic connection: API keys and similar single-token auth, plus username-and-password (basic auth) and digest auth.
- OAuth 1.0 and OAuth 2.0.
- JWT. There's no separate JWT type; Make's docs call a JWT "a special format of the Authorization header", built with the
jwt()function.
We build NativeShip, which writes these connections from the security section of your API spec. So we've met this 401 a lot.
Parameters: what the customer types
A connection has two halves. The first is its Parameters tab: the fields your customer fills in. For an API key, that's one field:
[
{
"name": "apiKey",
"label": "API key",
"type": "password",
"help": "Find your API key in your Acme CRM account settings.",
"required": true,
"editable": true
}
]
"type": "password"means Make never shows the stored value again."required": truemeans the connection can't be saved without it."editable": truelets people update the connection from the Connections page. When someone rotates their key, they edit the connection instead of rebuilding every scenario. Make's best practice is to make every connection parameter editable, with one exception: if each user has their own URL or domain, that parameter must not be editable.
One naming rule trips people up. Inside the connection, you read the field as {{parameters.apiKey}}. Everywhere else, in the base and in modules, it's {{connection.apiKey}}. Same value, different name, depending on where you stand.
Also avoid naming a parameter accountName or teamID. Make reserves both.
Fixing the 401
A 401 with a correct key almost always means the key went somewhere your API wasn't looking. There are three usual suspects.
1. The header name. Your API wants X-API-Key, and the app sends Authorization.
2. The prefix. Your API wants the word Bearer before the token, and it's missing. Or it's there twice.
3. The place. The key belongs in the query string, and you put it in a header.
The fix lives in the base, because that's where the key is added to every module's request. Open your API's docs and copy the format exactly. For Acme, it's a header:
{
"headers": {
"X-API-Key": "{{connection.apiKey}}"
}
}
If your API wants a bearer token instead:
{
"headers": {
"authorization": "Bearer {{connection.apiKey}}"
}
}
And if it wants the key in the query string:
{
"qs": {
"apikey": "{{connection.apiKey}}"
}
}
Use the parameter name your API's docs give (apikey here is only an example). Match the header name, the prefix, the place, all of it, and the 401 goes away.
The reason you can find it quickly is the next part.
Test the API key on save
The second half of a connection is its Communication tab. Make runs it when the user enters their credentials and clicks to create the connection. Here's the full communication for Acme:
{
"url": "https://api.acme.test/v2/me",
"method": "GET",
"headers": {
"X-API-Key": "{{parameters.apiKey}}"
},
"response": {
"error": {
"message": "[{{statusCode}}] {{body.message}}"
},
"metadata": {
"type": "email",
"value": "{{body.email}}"
}
},
"log": {
"sanitize": ["request.headers.`X-API-Key`"]
}
}
The validation call
Point url at an endpoint that needs only the key, like /me, /about or /whoami. Make's docs say every connection should have a way to check that the key is valid, and that if the key is wrong, the call returns an error and the connection won't be created.
So a wrong key shows an error right there in the dialog, something like [401] Invalid API key. Your customer finds out now, not days later when a scenario fails at midnight.
A basic connection can make only a single request, and iterate, output, limit and pagination aren't available in it.
Metadata: whose account is it
metadata takes a value from the reply and shows it in brackets after the connection's name, so "My Acme connection (ada@acme.example)". When someone has three Acme accounts, they can tell which is which. The type is email or text, and Make caps the value at 512 characters.
Sanitize here too
The connection's request carries the key, so sanitize it in the connection's log as well, the same rule as the base. Both base and connection sanitizing are on Make's review checklist.
Where NativeShip helps, and where it can't
This is one of the things NativeShip does for you. It looks through your spec for an endpoint that returns the signed-in user and needs nothing else, and the generated connection uses it as the test call, with the user's email as the account label.
If your spec has no endpoint like that, there's nothing safe to test against. NativeShip says so, and the connection it generates will save without checking the key. That's worth fixing by hand, because Make's review checks that bad credentials produce an error.
OAuth 2.0 in one minute
If your API uses OAuth, the idea is the same, with more steps. Make's OAuth 2.0 connection is a set of directives that run in order: preauthorize, authorize, token, info. Make sends your customer to your login page, swaps the code for a token, then calls info, which is your validation call and metadata in one. When the token is about to expire, refresh gets a new one. refresh and invalidate sit outside that first login flow.
Two things to get right.
The redirect URI. Register https://www.make.com/oauth/cb/app with your OAuth provider. If you're going to request Make's approval, use it together with the oauth.localRedirectUri variable, as Make's docs say.
Common data. Your client ID and secret go in the connection's common data, read as {{common.clientId}} and {{common.clientSecret}} (the names are yours to choose). It's stored encrypted, and once your app is approved, Make locks it and it can't be changed. So get it right before you ask for review.
What you have now
- a connection with the key hidden, required and editable
- a way to beat the 401: header name, prefix, place
- a test call that catches a bad key on save, and shows whose account it is
- the key kept out of the logs, in the base and the connection
In Level 4, we build modules people actually want to use, and fix the bug where the next module has nothing to map. Earlier levels: Level 1 and Level 2.
We build NativeShip, which writes the connection from your spec's security scheme, test call and account label included. Everything in this guide works without it.
Frequently asked questions
Usually the key is being sent somewhere your API isn't looking. Check three things in the base: the header name (for example X-API-Key vs Authorization), the prefix (a missing or doubled Bearer), and the place (header vs query string). Match them exactly to your API's docs.
Put a request in the connection's Communication tab that calls an endpoint needing only the key, such as /me or /whoami. Make runs it when the user creates the connection. If the key is wrong, the user sees the error and the connection isn't created.
Add metadata to the connection's response, for example "metadata": { "type": "email", "value": "{{body.email}}" }. The type can be email or text, and Make shows the value in brackets after the connection's name.
https://www.make.com/oauth/cb/app. If you plan to request Make's approval, use it with the oauth.localRedirectUri variable.
In the connection's common data, read as {{common.clientId}}-style variables. It's stored encrypted, and Make locks it once the app is approved, so get it right before review.