Work against a remote platform
Most fcdev commands work against the local platform. The commands that manage what runs on a
platform, fcdev fn (functions) and fcdev ingest (ingestions), can also work against a
shared one: a test environment, or production. They reach a remote platform only through a
profile: a named target with a recorded way to authenticate.
Against the local fcdev, those commands need nothing: they use the credential fcdev start writes
for them.
Two ways to authenticate
Section titled “Two ways to authenticate”A person (--login) |
A client (--client-id) |
|
|---|---|---|
| Who acts | You, with the roles you hold in the console | A service account’s OAuth client |
| Credential | A browser sign-in; the session is kept in the OS keychain | The client secret, held by reference (keychain, environment variable, file or command) |
| Lifetime | 7 days from sign-in, then sign in again | As long as the secret is valid |
| Use for | Your own work against a shared environment | CI and other unattended jobs |
Sign in as yourself
Section titled “Sign in as yourself”fcdev profile add np --platform https://np.example.com --env np --loginfcdev login --profile npfcdev fn status orders.reconcile --profile npfcdev login opens the platform’s sign-in page in your browser (it prints the URL if it cannot open
one) and waits up to 5 minutes. You sign in the normal way: password, SSO, passkey, a second factor.
The platform sends the browser back to a listener fcdev started on 127.0.0.1, and fcdev
exchanges the code for tokens (authorization code with PKCE; there is no client secret) and stores
the session in the OS keychain. It prints who you are and when the session ends.
- You act as yourself. The access token carries the roles and permissions you hold, no more. A role removed in the console, or a deactivated account, takes effect at the next refresh (within the hour).
- The session ends 7 days after sign-in. Refreshing does not extend it. The platform sets the
length (
FC_FCDEV_LOGIN_REFRESH_TTL_SECS, default 7 days); access tokens are refreshed silently in the meantime. - An unusable session fails fast. A command that needs the session fails with
session expired: run fcdev login --profile NAME(ornot logged in: ...). It never prompts, never opens a browser by itself, never falls back to another credential, and never waits. That is why CI cannot use a login profile. fcdev logout --profile nprevokes the session at the platform and deletes the local copy.fcdev profile listshows who is signed in to each profile and until when, never a token.
The platform must have the fcdev-cli OAuth client, which it creates on start (a public client:
PKCE required, authorization code and refresh grants only, loopback redirects only). If sign-in
reports that the client is missing, the platform is older than this feature or has not restarted
since. Deactivating that client in the console switches browser sign-in off for everyone.
Use a client credential (CI)
Section titled “Use a client credential (CI)”fcdev profile add np-ci --platform https://np.example.com --env np \ --client-id <oauth client id> --secret-ref env:FC_NP_SECRETfcdev profile test np-ciThe profile file never holds a secret, only a reference to one:
secret_ref |
Where the secret comes from |
|---|---|
keychain (the default) |
The OS secret store (service flowcatalyst-fcdev, account = the profile name). profile add without --secret-ref prompts for it, or use fcdev profile set-secret NAME. |
env:NAME |
The environment variable NAME. |
file:/absolute/path |
The file’s contents, trimmed. The file must be readable by its owner only (mode 0600 or tighter). |
command:<program and arguments> |
The trimmed output of the program, run without a shell, with a 30-second limit. |
env:, file: and command: need no keychain, which headless machines and CI do not have. For
example, a secret kept in a cloud parameter store:
fcdev profile add prod-ci --platform https://fc.example.com --env prod --client-id <id> \ --allow-noninteractive \ --secret-ref 'command:aws ssm get-parameter --name /flowcatalyst/prod/fn-cli-secret --with-decryption --query Parameter.Value --output text'fcdev profile test NAME mints a token with the profile’s credential and reports the principal, its
tier and the granted permissions, without printing the token or the secret.
Give CI the least it needs
Section titled “Give CI the least it needs”Do not give a CI credential platform:super-admin. Create a service account with:
| Role | Allows |
|---|---|
platform:function-publisher |
View, publish and promote versions of functions that already exist (publish, promote, deploy, status). |
platform:function-deployer |
The above, plus creating a function when it is missing (deploy --create --client <code>); this includes function manage, which also permits deleting functions. |
Setting secrets and database DSNs on a function (fcdev fn set --secret, --db) also needs
platform:function:secret:manage. The local fcdev fn credential is a super-admin, but it only
ever exists on a local fcdev.
Which target a command uses
Section titled “Which target a command uses”| You give | What happens |
|---|---|
--profile NAME (or FC_PROFILE) |
The profile decides the platform URL, the runner URL and the credential. --platform, --client-id and --client-secret are refused beside it; only --runner may override. FC_PLATFORM_URL, FC_RUNNER_URL, FC_CLIENT_ID and FC_CLIENT_SECRET are ignored, with a warning each. --profile wins over FC_PROFILE. |
| No profile, a loopback platform | Flags, then the FC_* variables, then the local fcdev credential file. |
| No profile, any other platform | Refused, with a message pointing at fcdev profile add. |
Loopback means localhost, *.localhost, 127.0.0.0/8 or ::1. A profile’s URL must use https
unless it is loopback, and must not contain a user name or password.
Production safety
Section titled “Production safety”Every fcdev fn command that talks to a platform first prints one line to standard error naming the
target, for example:
profile prod-ci (prod) https://fc.example.comThe env you give a profile (local, np or prod) is a label you choose; prod turns on the
guard. Against a prod profile, commands that change remote state (publish, promote, deploy,
set, delete, and invoke with any method other than GET or HEAD):
- on a terminal, ask you to type
prod(--yesdoes not skip this;deletethen also asks for the function’s address); - without a terminal, are refused unless you pass
--yesand the profile was created with--allow-noninteractive.
fcdev fn deploy --dry-run builds, validates and reports what it would create, publish and promote,
writing nothing and needing no confirmation.
The profile file
Section titled “The profile file”Profiles live in <config dir>/flowcatalyst/profiles.toml (~/.config on Linux,
~/Library/Application Support on macOS, %AppData% on Windows); FC_PROFILES_PATH moves it.
[profiles.np]platform = "https://np.example.com"runner = "https://np-runner.example.com" # optional; used by fcdev fn invokeenv = "np"auth = "login"
[profiles.prod-ci]platform = "https://fc.example.com"env = "prod"client_id = "<oauth client id>"secret_ref = "env:FC_PROD_SECRET"allow_noninteractive = trueauth is client_credentials (the default) or login. The file accepts a small subset of TOML
(tables, strings, booleans, comments), and fcdev profile add and remove rewrite it, so comments
you add by hand are not kept. Because a profile can name a command that fcdev runs as you, fcdev
refuses a profile file that other users can write; it creates the file 0600 in a 0700 directory.
Any key that looks like a secret (client_secret, token, password, …) is rejected.
Commands
Section titled “Commands”fcdev profile add <name> --platform URL --env np|prod|local (--login | --client-id ID [--secret-ref REF]) [--runner URL] [--allow-noninteractive]fcdev profile list | show <name> | test <name> | set-secret <name> | remove <name>fcdev login --profile <name>fcdev logout --profile <name>Related
Section titled “Related”- Publish, promote and use aliases: deploying functions with profiles,
including the CI flags
--skip-unchangedand--json. - Ingestion under fcdev:
fcdev ingestagainst local and remote platforms. - fcdev CLI reference.