# rpk ai auth login

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [agentic-data-plane-full.txt](https://docs.redpanda.com/agentic-data-plane-full.txt)

---
title: rpk ai auth login
latest-operator-version: v26.2.5
latest-console-tag: v3.14.0
latest-connect-version: 4.117.0
latest-redpanda-tag: v26.2.6
docname: rpk/rpk-ai/rpk-ai-auth-login
page-component-name: agentic-data-plane
page-version: master
page-component-version: master
page-component-title: Agentic Data Plane
page-relative-src-path: rpk/rpk-ai/rpk-ai-auth-login.adoc
page-edit-url: https://github.com/redpanda-data/adp-docs/edit/main/modules/reference/pages/rpk/rpk-ai/rpk-ai-auth-login.adoc
description: 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.
page-git-created-date: "2026-07-02"
page-git-modified-date: "2026-09-22"
page-generated-sources:
  - include: streaming:reference:partial$rpk-ai/rpk-ai-auth-login.adoc
    generator: rpk-docs
    version: null
    source: the rpk command help in redpanda-data/streaming-enterprise
page-generated-content: partial
---

<!-- Source: https://docs.redpanda.com/agentic-data-plane/reference/rpk/rpk-ai/rpk-ai-auth-login.md -->

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>`

## [](#usage)Usage

```bash
rpk ai auth login [flags]
```

## [](#flags)Flags

| Value | Type | Description |
| --- | --- | --- |
| --connection | string | Auth0 connection name to sign in with (skips the sign-in provider lookup). |
| --email | string | email address used to look up your sign-in provider before the browser opens (skips the prompt). |
| --env | string | name or ID of the Agentic Data Plane environment to select after sign-in (skips the environment prompt). |
| --no-browser | bool | do not attempt to open the browser; print the URL only. |

## [](#global-flags)Global flags

| Value | Type | Description |
| --- | --- | --- |
| --config | string | Redpanda or rpk config file; default search paths are ~/.config/rpk/rpk.yaml, $PWD/redpanda.yaml, and /etc/redpanda/redpanda.yaml. |
| -X, --config-opt | stringArray | Override rpk configuration settings; -X help for detail or -X list for terser detail. |
| --ignore-profile | bool | Ignore rpk.yaml and redpanda.yaml; use default settings. |
| --profile | string | rpk profile to use. |
| -v, --verbose | bool | Enable verbose logging. |