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
1create-specra loginThis will:
- Open your browser to the Specra login page
- After successful login, redirect back to the CLI
- Save your authentication token to the local
specra.config.json
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.
1{2 "site": { "title": "My Docs" },3 "auth": {4 "token": "your-token-here"5 }6}Global Storage
To store credentials in your home directory (~/.specra/config.json) instead of the project, use the --global flag:
1create-specra login --globalThis 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
Global config
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:
1# Clear local project token (from specra.config.json)2create-specra logout3 4# Clear global token (from ~/.specra/config.json)5create-specra logout --globalVerifying Authentication
You can check if you're authenticated by running any command that requires auth:
1create-specra projectsIf you're not logged in, you'll see:
Not authenticated. Run `specra login` first.
Options Reference
login
| Option | Description |
|---|---|
-g, --global | Store credentials in ~/.specra/ instead of local specra.config.json |
logout
| Option | Description |
|---|---|
-g, --global | Clear credentials from ~/.specra/ instead of local specra.config.json |