4. API keys
Level: integration. How to generate the key the apps read their configuration with, what it decides, how to find it again and how to revoke it. The previous page is Members and roles, the next one is Audit log.
The API keys page is seen by the Editor, the Admin and the Owner. For the others the message is “You need to be an editor, admin or owner of this tenant to manage its API keys.”
At the top of the page, under the title, the Use the key with an SDK link leads to the SDK page, with the line that installs the SDK in the app that will use the key (page 1). The link is there for every role.
What a key is, exactly
An API key is the credential an app — not a person — asks for its configuration with. It belongs to one environment only, and from it Squiddy understands where the request comes from:
| Where it comes from | What it carries |
|---|---|
| The API key | Organization, project and environment |
| The app, on every request | Its appId and its context (version, platform, language…) |
With both, Squiddy answers with the right configuration for that app.
The only coordinate the app declares is the appId: organization, project and environment come from the key. Three practical consequences follow:
- the key decides which configuration the app receives. A
productionkey in a test build of the app gives no error at all: the app receives the production configuration; - one key serves every app of the environment: the
appIdtells the apps apart, the key tells the environment. You do not need one key per app (but nothing forbids it, if you need to be able to revoke them separately); - a key is not personal: it is not tied to whoever generated it, and removing that person from the organization does not revoke it (page 3).
Generating a key
Press Generate key and fill in three fields, one after the other:
| Field | Notes |
|---|---|
| Project | Only used to reach the environment |
| Environment | Picked after the project: it is the environment the key will give access to |
| Name | A name for you (for example CI pipeline, iOS production app): it is what you will read in the list when you have to decide whether to revoke it |
Press Generate key again: the API key created box appears in the window, with the whole key and this notice:
Copy CI pipeline now and keep it somewhere safe. If you lose it, the API keys list can show it again.
(with the name you gave the key).
Squiddy keeps the key encrypted. Whoever can manage the organization's keys can have it shown again from the list (see below), and every time a trace is left in the audit log as key shown. Keys created before Squiddy started keeping them encrypted can no longer be read again, by anyone: if you have lost one, generate another and revoke the old one.
Where to keep it. In the secrets manager of whoever builds the app, never in the source code. A distributed app, though, carries it inside the installed package, and anyone who has the app can extract it: a key inside an app is not a secret. It only allows reading the environment's published configurations — for whatever appId, platform, mode or parameter whoever uses it chooses to send — and using up the key's request limit, which depends on the plan (page 1). It gives no access to the dashboard and does not allow changing anything. Two rules follow: put nothing in the configurations that you would not show to whoever uses the app, and think about which environment the key serves and how much it would cost to replace it (below). The SDK guide, on the documentation site, explains this to whoever connects the app.
In the dashboard the service the apps read their configuration from is also called the data plane: it is what the key gives access to.
The list
| Column | Content |
|---|---|
| Name | The name you chose (it can be changed) |
| Key | The start of the key, not the whole key: it is there to recognize it in the list without showing it. For an active key, next to it, Show and Copy (below) |
| Environment | The environment it gives access to |
| Created | When it was generated |
| Last used | The last time a request used it, or Never. It can lag a few minutes behind, and it is not an access log: it is there to answer the question “is anyone still using this key?” |
| Status | Active or Revoked |
Above the list you can search for a key by name. Renaming a key changes only the name: the key and what it allows stay the same.
Seeing or copying a key again
Next to the start of every active key there are two commands:
- Show puts the whole key in place of its start; Hide takes it away again;
- Copy copies the whole key to the clipboard without showing it — useful to paste it into the secrets manager without having it on screen — and confirms it with a tick.
The first time you use either of them, Squiddy hands you the key and writes in the audit log who asked for it (key shown, with the name and the start of the key, never the whole key). As long as you stay on the page, the following commands do not ask for it again.
A revoked key does not have these commands: a key that no longer works is not shown. Neither does a key created before Squiddy kept keys encrypted, and in their place it says: “Can't be shown again: created before keys were stored. Generate a new one if you need it.”
Revoking
From the row's menu → Revoke, with the confirmation:
Revoke CI pipeline? Any client using it loses access immediately. This cannot be undone.
(with the name of the key). Both statements are to be taken literally:
- immediately: from the next request on, the apps that use it no longer receive their configuration (to Squiddy it is an unknown key) and use the one they had saved before;
- cannot be undone: a revoked key is not reactivated. It stays in the list as Revoked, as a record of what it was.
To replace a key, follow this order: generate the new one, put it in the apps and check that the apps use it, and only then revoke the old one. The Last used column tells you whether anyone still uses the old one.
When the apps do not receive the configuration
Three different causes that look alike from the outside, and how to tell them apart:
| Symptom | Likely cause | Check |
|---|---|---|
| Credential refused | Wrong key, or revoked | The Status in the list; is the start of the key the one of the key you put in the apps? |
| Configuration not found | The appId has no configuration in that environment, or the key points to another environment | Open the Configurations page of the key's environment and look for the appId |
| Access blocked for the account | The organization is suspended with serving blocked | The suspension screen says so when you enter the dashboard (page 1) |
The third case differs from the first on purpose: whoever connects the app must understand that the problem is not the key, and not waste time replacing it.
If instead the configuration arrives but is not the one you expect, the problem is not the key (unless it points to the wrong environment): it is the way the configuration picks the answer, and you find it out with the Tester of the Configurations page (Configurations).