Exchange an external identity for an Xratu token¶
What you will end up with¶
An Xratu token on your active CLI profile, and a resolved actor that is no longer the system one.
Prerequisites¶
- A CLI profile pointing at a reachable control plane. See Configure a CLI profile.
- An identity provider session you are already authenticated with. Xratu does not authenticate you with your provider.
- For generic OIDC, the issuer and audience already configured on the control plane. See Custom enterprise OIDC.
1. Clear any stale token¶
A token from a previous control plane or a previous session will be sent with the exchange request and produces confusing failures.
2. Obtain a provider token¶
Run the block for your provider. The audience is the control plane in every case.
# GCP: requires a service-account identity or impersonation
TOKEN="$(gcloud auth print-identity-token \
--impersonate-service-account=<service-account-email> \
--audiences=xratu-control-plane)"
# Azure
TOKEN="$(az account get-access-token \
--resource xratu-control-plane \
--query accessToken -o tsv)"
Confirm you have one before continuing:
3. Exchange it¶
Substitute --provider aws, --provider azure or --provider oidc as
appropriate. The flag may be omitted entirely, in which case the control plane
infers the provider from the token's issuer.
Add --ttl-seconds to request a different lifetime; the default is 3600 and
values below 300 are raised to 300.
Expected output¶
The response carries the issued token, the resolved actor and the provider:
{
"access_token": "...",
"token_type": "bearer",
"actor_id": "user:alice@acme.example",
"provider": "gcp"
}
--set-token writes the token to the active profile. --set-actor stores
actor_id there as local metadata, which is for your reference and grants
nothing.
4. Verify it worked¶
Three things must hold:
| Field | Expected |
|---|---|
actor_id |
Not system |
auth_context.mode |
token |
auth_context.token_provider |
The provider you exchanged against |
As a single check:
Confirm the profile holds the token:
When it fails¶
403 cloud token exchange is disabled. External token trust is off on the
control plane. Inspect the posture:
On a finalized deployment this setting is locked and enabling it is a break-glass act.
403 unable to resolve actor from external token. The control plane did not
accept the provider token. The cause differs by provider:
- GCP: most often a user credential rather than a service-account identity token. Minting an audience-scoped identity token requires service-account identity or impersonation.
- AWS and Azure: the audience does not match, or the token is not from a recognised issuer.
- Generic OIDC: the issuer is not allowlisted. Trust for
oidccomes from configuration, so expect this until the issuer is added.
whoami still returns system after a successful exchange. The CLI is not
sending the issued token. Confirm --set-token was passed, that the profile
holds a token, and that the profile is the active one.
The token was rejected for its email domain. The response context reports
email_domain_not_allowed. The control plane restricts which email domains it
accepts, and yours is outside the list.
What changed¶
Your active profile now holds an Xratu token, and requests resolve to a real actor. Nothing on the control plane was created: no account record exists, because actors are derived from claims rather than stored.
You still have no permissions beyond what role bindings grant. The next step is tenancy, where creating an organisation binds you as its owner. See Create your first organization and workspace.