rpk ai auth login
Run the OAuth 2.0 device authorization grant against Redpanda Cloud, persist the resulting credentials, and select an Agentic Data Plane environment in the organization. The selected environment becomes the current environment.
Credentials are stored in the rpk ai credentials file with 0600 permissions, keyed by organization.
By default, login prompts you to choose an environment. To skip the prompt, pass --env with an environment name or ID. In scripts and coding agents, which can’t respond to a prompt, --env is required if the organization has more than one Agentic Data Plane environment. --env also replaces the current environment, including a manual environment. If no environment matches, login fails after you sign in but keeps the new credentials, so you can run rpk ai env use <name> to finish selecting an environment.
A successful login rewrites the config in the current schema, so running rpk ai auth login is also how you migrate a config left over from an older version of the plugin.
rpk ai auth login always runs the device flow and replaces the stored credentials for the organization, even when the current token has not expired, because a token that looks valid locally may already be revoked. Without --env, re-authenticating keeps the current environment: if the organization is unchanged, the existing selection is confirmed without a prompt, and a manual environment is left unchanged.
Login replaces the local credential but does not revoke the previous token, which remains valid at the identity provider until it expires. To remove the local session, run rpk ai auth logout, or rpk ai auth logout --all to remove the sessions for every organization.
In a script, check whether you are already logged in before you call login:
rpk ai auth status -o json | jq -e .logged_in >/dev/null || rpk ai auth login --env <environment>
Flags
| Value | Type | Description |
|---|---|---|
|
string |
Auth0 connection name to sign in with (skips the sign-in provider lookup). |
|
string |
email address used to look up your sign-in provider before the browser opens (skips the prompt). |
|
string |
name or ID of the Agentic Data Plane environment to select after sign-in (skips the environment prompt). |
|
bool |
do not attempt to open the browser; print the URL only. |
Global flags
| Value | Type | Description |
|---|---|---|
|
string |
Redpanda or |
|
stringArray |
Override |
|
bool |
Ignore |
|
string |
|
|
bool |
Enable verbose logging. |