> For the complete documentation index, see [llms.txt](https://docs.onepub.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.onepub.dev/guides/cli-integration/cli-tools.md).

# login

## Authentication

Before you can run any OnePub command, you must first log in to OnePub.

```
onepub login
```

{% hint style="warning" %}
You don't need to run `dart pub token add` as the `onepub login` command does this for you.
{% endhint %}

#### Multiple devices

You can log in to the OnePub CLI from multiple devices.

## Enterprise SSO

To sign in to a specific organisation:

```sh
onepub login sso acme2345
```

Replace `acme2345` with your organisation's code. Open the printed URL in a browser and complete sign-in within five minutes. You can open the URL on another device when using SSH or a terminal without a browser.

After a successful sign-in, `onepub login` remembers the method and organisation for the configured OnePub server. Use `onepub login --choose` to choose again.

`onepub login browser` uses ordinary browser sign-in. `onepub login trusted` continues to use trusted CI authentication. A failed or cancelled login keeps your previous credentials and preference.

Routing preferences are separate from credentials. Local, beta and production servers have separate preferences. `onepub logout` retains the preference; `onepub logout --forget` also clears it for the configured server.

If the server does not support enterprise SSO, an explicit SSO login reports that limitation. Ordinary login remains available.
