Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 14 additions & 27 deletions cli/authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,25 @@ Sprites uses your Fly.io account for authentication. This guide covers setting u
The simplest way to authenticate:

```bash
sprite org auth
sprite login
```

This opens a browser window to authenticate with Fly.io. Once complete, you're ready to use Sprites.
This opens a browser window where you sign in to Fly.io and approve the CLI. Once complete, you're ready to use Sprites.

## Authentication Flow

### 1. Authenticate with Fly.io

If you're already logged into `flyctl`, the Sprites CLI can use your existing session:

```bash
sprite org auth
sprite login
```

If you're not logged in or encounter issues:

```bash
# First, ensure you're logged into fly
fly auth logout
fly auth login
This signs you in to Fly.io in the browser, then adds an API token for your organization. You don't need to be logged into `flyctl` first. If the browser doesn't open, open the link the command prints.

# Verify your flyctl session works
fly apps list
To log in to a specific organization:

# Then authenticate with Sprites
sprite org auth
```bash
sprite login -o my-team
```

### 2. Select an Organization
Expand All @@ -56,7 +48,7 @@ Organizations:
another-org
```

To switch organizations:
To add another organization:

```bash
sprite org auth --org my-team
Expand Down Expand Up @@ -123,7 +115,7 @@ When using file-based storage, `~/.sprites/sprites.json` contains:

### Adding Organizations

Add tokens for multiple organizations:
After you log in with `sprite login`, add tokens for more organizations:

```bash
# Add another organization
Expand All @@ -140,7 +132,7 @@ sprite org list
sprite -o my-team list

# Set default organization
sprite org auth --org my-team
sprite org set-default my-team
```

### Per-Directory Organization
Expand Down Expand Up @@ -216,12 +208,7 @@ export SPRITES_API_URL="https://api.sprites.dev" # Override API endpoint

```bash
# Re-authenticate
sprite org auth

# If that fails, reset and try again
fly auth logout
fly auth login
sprite org auth
sprite login
```

### Token Not Found
Expand All @@ -236,7 +223,7 @@ sprite org keyring disable
cat ~/.sprites/sprites.json | grep api_token

# Re-authenticate if needed
sprite org auth
sprite login
```

### Browser Doesn't Open
Expand All @@ -253,8 +240,8 @@ If the authentication browser doesn't open automatically:
If you get permission errors after authentication:

1. Verify your Fly.io account has access to the organization
2. Check that your `flyctl` session is valid: `fly apps list`
3. Try re-authenticating: `sprite org auth`
2. Check which organizations the CLI has tokens for: `sprite org list`
3. Try re-authenticating: `sprite login`

## Security Best Practices

Expand Down
8 changes: 2 additions & 6 deletions quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,10 @@ sprite --help
Sprites uses your Fly.io account for authentication:

```bash
sprite org auth
sprite login
```

This opens a browser window to authenticate with Fly.io.

<Info>
If authentication fails, try running `fly auth logout` followed by `fly auth login` first, then retry `sprite org auth`.
</Info>
This opens a browser window where you sign in to Fly.io and approve the CLI. If the browser doesn't open, open the link the command prints.

## Create Your First Sprite

Expand Down
2 changes: 1 addition & 1 deletion working-with-sprites.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ umount /tmp/sprite-mount
### Common Error Scenarios

**Connection errors:**
- Check auth: `sprite org auth`
- Re-authenticate: `sprite login`
- Verify Sprite exists: `sprite list`
- Wait a moment and retry

Expand Down
Loading