# spin login

**Spinbox is experimental: APIs change and data may be lost.** What is built and what proves it is on [Status](https://docs.spinbox.dev/reference/status.md); what Spinbox does not do is on [Limitations](https://docs.spinbox.dev/overview/limitations.md).

> spin login: Authenticate with the platform.

<!-- Generated by tools/refgen from spin:cmd/cli. Edit the source, not this file. -->

```
Authenticate with the platform, saving the login as the profile (--profile, default
"default"): each profile is its own server and credential.

There are two ways to authenticate:

1. A code: this prints a URL and a code, and opens the URL with your browser when
   possible. Sign in there from this machine or any other and enter the code; this
   waits until you have, then keeps the session it is given. Nothing listens here.

2. API key: Create an API key in the dashboard (Settings > API Keys) and pass it on
   standard input with --token-stdin. This is the recommended method for CI/automation;
   a key on the command line would be readable by every user of the machine.

The server is --endpoint, else SPIN_ENDPOINT, else the one the profile is already logged in
to, else https://app.spinbox.dev.

With --no-browser and -o json, the code is written as a first line of JSON before the wait
({verification_url, user_code, expires_in}), and the login as a second
({profile, endpoint, user}): a program shows the code itself and reads each line as it comes.

Examples:
  spin login                                    # Sign in with a code, in a browser
  spin login --no-browser -o json               # the same, for a program that shows the code
  spin login --token-stdin < key.txt            # Login with an API key (recommended for CI)
  printenv SPIN_KEY | spin login --token-stdin  # the same, from a CI secret

Usage:
  spin login [flags]

Flags:
      --endpoint string            API endpoint URL (default: SPIN_ENDPOINT, the profile's, or https://app.spinbox.dev)
  -h, --help[=true|false]          help for login
      --no-browser[=true|false]    do not open the code's page in a browser; with -o json, write the code as a first line of JSON
      --token-stdin[=true|false]   read an API key (Settings > API Keys) from standard input instead of signing in with a code

Global Flags:
      --config string        config file (default is $HOME/.spin/config.yaml)
  -o, --output string        text for a person, or json: one document of what the API answered, and no prose (default "text")
      --profile string       named profile to use; SPIN_PROFILE names it when this flag does not (default "default")
      --traceparent string   the W3C traceparent of the span this command is part of; its own span is sent to the installation unless the profile says telemetry: false
```
