> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sb0.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# sb0 login

> Authenticate with the sb0 platform

## Command

```bash theme={null}
sb0 login
```

## Description

Authenticates your CLI with the sb0 platform. Required before you can push agents or query deployed agents.

## Usage

```bash theme={null}
sb0 login
```

This will open your browser to complete authentication, or provide a link if the browser doesn't open automatically.

### Expected Flow

```
Opening browser for authentication...
Waiting for authentication to complete...
✔ Successfully authenticated!

Your credentials have been saved locally.
```

## When to Login

You need to login:

* **Before first push** - To deploy agents to the platform
* **Before querying** - To access your deployed agents
* **After logout** - If you previously logged out
* **New machine** - When setting up on a new computer

You do NOT need to login for:

* **Local development** - Using `sb0 init`, `sb0 run`, `sb0 build`
* **Reading documentation** - Accessing public resources

## Credentials Storage

Authentication credentials are stored locally in:

```
~/.sb0/credentials
```

These credentials are used automatically for `sb0 push` and `sb0 query` commands.

<Note>
  Keep your credentials secure. Don't share them or commit them to version control.
</Note>

## Session Duration

Sessions remain active until you explicitly logout or the token expires.

## Logout

To logout and remove stored credentials:

```bash theme={null}
sb0 logout
```

## Common Issues

### Browser Doesn't Open

If the browser doesn't open automatically, copy the URL from the terminal and paste it into your browser manually.

### Authentication Fails

```
Error: Authentication failed
```

**Possible solutions:**

* Check your network connection
* Ensure you're using the latest version of the CLI
* Try logging out and logging in again

### Permission Denied

```
Error: Could not write credentials
```

**Solution:** Ensure you have write permissions to `~/.sb0/` directory:

```bash theme={null}
mkdir -p ~/.sb0
chmod 700 ~/.sb0
```

## Next Steps

After logging in:

1. **Build your agent:**
   ```bash theme={null}
   sb0 build
   ```

2. **Push to platform:**
   ```bash theme={null}
   sb0 push
   ```

3. **Query your agent:**
   ```bash theme={null}
   sb0 query "test question"
   ```

## Related

* [Deploy to platform](/v0-docs/cli/push)
* [Query deployed agent](/v0-docs/cli/query)
* [Publishing workflow](/v0-docs/quickstart/publishing)
