# dflow login

> Sign in and save the session on this machine.

Web page: /docs/cli/account/login/

This signs you in and saves the session for later commands. On a terminal it asks for your email and password. A script that already has a workspace token passes that token on stdin instead.

```bash
dflow login
dflow login --email ADDRESS
dflow login --google
dflow login --github
dflow login --api URL --token TOKEN
```

## Flags

`--api` is an optional server origin. Leaving it off uses the server saved by `dflow context:use`, or `https://k8s.dflow.sh` when none is saved.

On a terminal, with no `--email`, no provider flag, and no token flag, the CLI prints `Email:` and then `Password:`. `--email` skips the email question and prints `Password:`. The password is read with echo off.

`--google` or `--github` opens a browser sign-in when the server has that provider. The CLI prints an authorization URL, waits for you to finish in the browser, polls the API, and saves the session. It does not print tokens.

`--accept-terms` records acceptance when the server has a terms version. On a terminal, leaving it off asks `Accept the terms VERSION? Type yes:`.

`--token` or `--token-stdin` saves an existing token and does not ask for a password. `--token` is visible in the process list, so prefer `--token-stdin` on a shared machine. The token is one string of 20 to 256 characters from `A-Za-z0-9._~+/=-`.

Without a terminal, login needs an email, a provider flag, or a token. Otherwise it exits 1.

## What you see

The terminal prints `api` and `token`. `token` is the word `present`. The secret is not printed. When the login is inside one workspace, `org` is that workspace id. When the login belongs to more than one workspace, a table lists `NAME`, `ID`, and `ROLE`.

When the server channel is `beta`, stderr prints `This service is a beta.` Exit 0 means the session was saved.

## When it fails

Exit 1: a bad URL, a bad token, or a config path that is a symlink. Exit 2: the API rejected the token or returned `terms_not_accepted`. Exit 10: the API could not be reached. Exit 7 when the HTTP call exceeds 60s, or when the browser sign-in poll expires.
