Authentication

Log in to your Specra account and manage credentials for deploying documentation

Authentication

Before deploying to Specra Cloud, you need to authenticate. The CLI opens your browser to log in and stores your token for future commands.

Login

Code
bash
1create-specra login

This will:

  1. Open your browser to the Specra login page
  2. After successful login, redirect back to the CLI
  3. Save your authentication token to the local specra.config.json
Info
If the browser doesn't open automatically, the CLI prints a URL you can copy and paste.

Token Storage

By default, your token is stored per-project in specra.config.json under the auth field. This means different projects can use different Specra accounts.

Code
json
1{
2 "site": { "title": "My Docs" },
3 "auth": {
4 "token": "your-token-here"
5 }
6}
Warning
If your `specra.config.json` is committed to git, make sure to add the `auth` section to your `.gitignore` or use `--global` storage instead. You can run `create-specra doctor` to check for this.

Global Storage

To store credentials in your home directory (~/.specra/config.json) instead of the project, use the --global flag:

Code
bash
1create-specra login --global

This is useful when:

  • You use the same account across all projects
  • You don't want tokens in your project directory
  • You're working in a CI/CD environment with a shared user

Token Resolution

When running commands that require authentication, the CLI checks for a token in this order:

Local config

Checks `specra.config.json` in the current directory for `auth.token`

Global config

Falls back to `~/.specra/config.json` if no local token is found

Fallback Behavior

If you run create-specra login without --global and there's no specra.config.json in the current directory, the CLI automatically falls back to saving the token globally and warns you:

⚠ Could not save to local config: specra.config.json not found
  Falling back to global ~/.specra/ config
✓ Token saved globally.

Logout

Clear your stored credentials:

Code
bash
1# Clear local project token (from specra.config.json)
2create-specra logout
3 
4# Clear global token (from ~/.specra/config.json)
5create-specra logout --global

Verifying Authentication

You can check if you're authenticated by running any command that requires auth:

Code
bash
1create-specra projects

If you're not logged in, you'll see:

Not authenticated. Run `specra login` first.

Options Reference

login

OptionDescription
-g, --globalStore credentials in ~/.specra/ instead of local specra.config.json

logout

OptionDescription
-g, --globalClear credentials from ~/.specra/ instead of local specra.config.json