| title | Authentication | ||
|---|---|---|---|
| sidebar |
|
datumctl uses OAuth 2.0 and OpenID Connect (OIDC) with the PKCE extension for
secure authentication against Datum Cloud. This avoids the need to handle static
API keys directly.
Authentication involves the following commands:
datumctl logindatumctl logoutdatumctl whoamidatumctl auth listdatumctl auth get-tokendatumctl auth update-kubeconfigdatumctl auth switch
Credentials and tokens are stored securely in your operating system's default keyring.
To authenticate with Datum Cloud, use the login command:
datumctl login [--hostname <auth-hostname>] [--no-browser] [--credentials <file>] [--project <project> | --organization <org>] [-v]
--hostname <auth-hostname>: (Optional) Specify the hostname of the Datum Cloud authentication server. Defaults toauth.datum.net.--no-browser: (Optional) Do not attempt to open a browser; print the login URL and use the device authorization flow (enter a user code) so you can complete login without a local callback.--credentials <file>: (Optional) Sign in as a service account using its credentials JSON file. Non-interactive; see Service accounts.--project <project>/--organization <org>: (Optional) The context to switch to after signing in, instead of choosing one in the picker. A project can be given as<org>/<project>.DATUM_PROJECTandDATUM_ORGANIZATIONwork the same way when neither flag is set.-v, --verbose: (Optional) Print the full ID token claims after successful login.
Running this command will:
- Attempt to open your default web browser to the Datum Cloud authentication
page (or use device authorization if
--no-browseris used). - If the browser cannot be opened automatically, it will print a URL for you to visit manually.
- Authenticate via the web page (this might involve entering your username/password or using single sign-on).
- After successful authentication, you will be redirected back to
datumctl(via a local webserver started temporarily), which completes the process.
Your credentials (including refresh tokens) are stored securely in the system keyring, associated with your user identifier (typically your email address).
After signing in, datumctl login switches to a default context:
- With
--project,--organization,DATUM_PROJECTorDATUM_ORGANIZATION, it switches to that context. If none of your organizations or projects match, login keeps the session and exits with an error naming the value. - With a single organization and no projects, it switches to that one.
- Otherwise it shows a picker. The picker needs an interactive terminal.
Without one (a coding agent's shell, a script), login still signs you in
and saves the session, but leaves the context unset. Choose one afterwards
with
datumctl ctx use <org>/<project>;datumctl ctxlists them.
A service account is a non-human identity for CI pipelines, scheduled jobs, and other automation. It signs in with a credentials file instead of a browser, so there are no prompts and no human account involved.
Create the service account in the
Datum Cloud portal (for staging,
https://cloud.staging.env.datum.net) and download its credentials JSON
file. The file has "type": "datum_service_account" and carries the
account's client_id, client_email, and an RSA private key. Treat it as a
secret: store it in your CI provider's secret store and write it to disk only
on the runner.
The same file works against any environment; --hostname picks which one.
Human accounts cannot use this path.
datumctl login --credentials ./key.json
For staging:
datumctl login --credentials ./key.json --hostname auth.staging.env.datum.net
datumctl exchanges a signed JWT for an access token and stores the session in
the keyring. The private key is kept on disk under your user config directory
(datumctl/service-accounts/) so the token can be renewed without the
original file. There is no refresh token: when the access token expires,
datumctl mints a new JWT and exchanges it again automatically, for as long as
the key stays valid.
On a CI runner with no system keyring, datumctl falls back to a plain file
at ~/.datumctl/credentials.json (mode 0600) and prints a warning at login.
Treat that file like the credentials file itself.
In CI there is no terminal for the context picker, so set the scope on each
command with DATUM_PROJECT or DATUM_ORGANIZATION (or the --project /
--organization flags):
DATUM_PROJECT=my-project datumctl diff -f manifest.yaml
DATUM_PROJECT=my-project datumctl apply -f manifest.yaml
DATUM_ORGANIZATION=my-org datumctl get projects
If the service account can see exactly one organization or project, login selects it as the context automatically. If it can see more, login in a non-interactive shell reports that context selection needs a terminal; the session is still signed in, and scoping each command as above is the supported pattern.
The session is listed like any other, under the account's client_email:
$ datumctl auth list
User Status
<client_email> Active
datumctl ctx lists the organizations and projects the service account can
reach, and datumctl whoami shows the account's identity and the effective
scope. The service account must have access to the target organization, and
that organization must have completed onboarding (see below). To remove the
session, run datumctl logout <client_email>.
Before you can use datumctl against an organization, that organization must complete onboarding in the Datum Cloud portal. This includes finishing billing setup (contact information, billing account, and payment method).
Onboarding is checked per organization, based on your active context or
--organization / --project flags. User-scoped discovery commands such as
datumctl get organizations always run against your user control plane, even
when your active context points at an incomplete organization. That command
also shows each organization's setup status and portal links for any that
still need setup.
When the targeted organization is incomplete:
datumctl loginstores your credentials but blocks selecting that organization's context and prints a link to the portal.- Org- or project-scoped commands are blocked with a message pointing you to the portal.
datumctl whoamishows onboarding status for your current context's organization.
Machine accounts are subject to the same requirement for the organization they target.
For staging environments, use the staging portal at
https://cloud.staging.env.datum.net.
Once logged in, you typically need to configure kubectl to authenticate to
Datum Cloud Kubernetes clusters using your datumctl login session. Use the
update-kubeconfig command:
datumctl auth update-kubeconfig [--kubeconfig <path>] [--project <name>] [--organization <name>]
--kubeconfig <path>: (Optional) Path to the kubeconfig file to update. Defaults to the standard location ($HOME/.kube/configor the path specified by theKUBECONFIGenvironment variable).--project <name>: Specify the Datum Cloud project name to configure access for. You can find project IDs after creating projects in Datum Cloud.--organization <name>: Specify the Datum Cloud organization name to configure access for. You can find your organization ID usingdatumctl organizations list.
Important
You must specify either --project or --organization.
This command adds or updates the necessary cluster, user, and context entries
in your kubeconfig file. The user entry will be configured to use
datumctl auth get-token --output=client.authentication.k8s.io/v1 as an exec
credential plugin. This means kubectl commands targeting this cluster will
automatically use your active datumctl login session for authentication.
To see which users you have authenticated locally, use the list command:
datumctl auth list
# Alias: datumctl auth ls
This will output a table showing the Name, Email, and Status (Active or blank)
for each set of stored credentials. The user marked Active is the one whose
credentials will be used by default for other datumctl commands and
kubectl (if configured via update-kubeconfig).
If you have logged in with multiple user accounts (visible via
datumctl auth list), you can switch which account is active using the
switch command:
datumctl auth switch <user-email>
Replace <user-email> with the email address of the user you want to make
active. This user must already be logged in.
After switching, subsequent commands that require authentication (like
datumctl organizations list or kubectl operations configured via
update-kubeconfig) will use the credentials of the newly activated user.
To remove stored credentials, use the logout command.
Log out a specific user:
datumctl logout <user-email>
Replace <user-email> with the email address shown in the
datumctl auth list command.
Log out all users:
datumctl logout --all
This removes all Datum Cloud credentials stored by datumctl in your keyring.
The get-token command retrieves the current access token for the active
authenticated user. This is primarily used internally by other tools (like
kubectl) but can be used directly if needed.
datumctl auth get-token [-o <format>]
-o, --output <format>: (Optional) Specify the output format. Defaults totoken.token: Prints the raw access token to standard output.client.authentication.k8s.io/v1: Prints a KubernetesExecCredentialJSON object containing the ID token, suitable forkubectlauthentication.
If the stored access token is expired, get-token will attempt to use the
refresh token to obtain a new one automatically.