# spin login

**Spinbox is experimental: APIs change and data may be lost.** What is built and what proves it is on [Status](https://spin-stack.github.io/website/reference/status.md); what Spinbox does not do is on [Limitations](https://spin-stack.github.io/website/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.

Examples:
  spin login                                    # Sign in with a code, in a browser
  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              help for login
      --token-stdin       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")
```
