Login & Setup
club login
Authenticate with a club server. By default, club login opens your browser and runs an OAuth 2.0 Authorization Code flow with PKCE, requesting scopes read,write. On success the CLI receives a scoped personal access token, stores it in ~/.config/club/credentials.json, and registers it with dart pub token add.
club login <server-url> [--email <email>] [--no-browser] [--key <club_pat_...>]Options
| Option | Description |
|---|---|
<server-url> | The club server URL (required) |
--key | Skip interactive login and store the provided personal access token directly. |
--email | Pre-fill the email (used by the --no-browser fallback; also a hint for the browser consent screen). |
--no-browser | Disable the browser flow and prompt for email + password in the terminal. |
There is no --password flag. If you need to paste an existing token, use --key club_pat_....
What It Does (browser flow)
- Starts a short-lived local callback listener.
- Opens the browser at the server’s
/oauth/authorizeendpoint (scoperead,write, PKCE). - The server authenticates you (if you are not already signed in) and asks you to approve the token.
- After approval, the server redirects to the local listener with an authorization code, which the CLI exchanges for a personal access token.
- Stores the token in
~/.config/club/credentials.json, sets this server as the default, and runsdart pub token add <server-url>automatically.
Example
$ club login https://club.example.comOpening browser for https://club.example.com/oauth/authorize...Waiting for authorization...Logged in as jane@example.comToken stored for https://club.example.comRegistered token with dart pub.Non-browser fallback
club login https://club.example.com --no-browser --email jane@example.comThis prompts for your password in the terminal and exchanges it for a personal access token via the server’s login API.
Using an existing token
club login https://club.example.com --key club_pat_abc123...Use this when you already generated a personal access token through the web UI (for example, for CI).
club setup
Configure dart pub to work with your club server. This is the key integration command that bridges club credentials with dart pub.
club setup [--server <url>] [--env-var <VAR_NAME>]Options
| Option | Description |
|---|---|
--server | Server URL (default: current default server) |
--env-var | Use an environment variable for the token instead of storing it directly |
What It Does
- Retrieves the stored token for the server from
~/.config/club/credentials.json - Runs
dart pub token add <server-url>to register the token in dart pub’s credential store - Prints instructions for adding packages to
pubspec.yaml
Example
$ club setupConfiguring dart pub for https://club.example.com...Token registered with dart pub.
To use packages from club, add to your pubspec.yaml:
dependencies: my_package: hosted: https://club.example.com version: ^1.0.0
Or set PUB_HOSTED_URL to use club as the default:
export PUB_HOSTED_URL=https://club.example.comCI/CD Setup with Environment Variable
For CI/CD environments, use the --env-var flag to avoid storing tokens on disk:
$ club setup --env-var CLUB_TOKENConfiguring dart pub for https://club.example.com...Running: dart pub token add https://club.example.com --env-var CLUB_TOKEN
To use in CI/CD, set the CLUB_TOKEN environment variable to your API token.club logout
Remove stored credentials for a server.
club logout [--server <url>] [--all]Options
| Option | Description |
|---|---|
--server | Server URL to logout from (default: current default server) |
--all | Remove credentials for all servers |
Example
$ club logoutLogged out from https://club.example.com$ club logout --allLogged out from all servers.club config
Show or update CLI configuration. There are exactly two subcommands:
club config # Show current config (same as `config show`)club config show # Show current configclub config set-server <url> # Set default serverExample
$ club configDefault server: https://club.example.comLogged in as: jane@example.comCredentials: ~/.config/club/credentials.json
Configured servers: https://club.example.com (default) https://staging.club.example.comSwitching Default Server
If you work with multiple club servers (for example, production and staging), use set-server to switch:
club config set-server https://staging.club.example.comAll subsequent commands will target the new default server. Use club publish --server <url> to override it on a per-invocation basis.
Credential Storage
File Location
| Platform | Path |
|---|---|
| Linux / macOS | ~/.config/club/credentials.json |
| Windows | %APPDATA%\club\credentials.json |
File Format
{"defaultServer": "https://club.example.com","servers": { "https://club.example.com": { "token": "club_pat_a1b2c3d4e5f6...", "email": "jane@example.com", "createdAt": "2026-04-09T10:00:00.000Z" }, "https://staging.club.example.com": { "token": "club_pat_x9y8z7w6...", "email": "jane@example.com", "createdAt": "2026-04-09T11:00:00.000Z" }}}Security
- File permissions are set to
chmod 600on Unix (owner read/write only) - Tokens are stored in plaintext (same approach as
~/.pub-cache/credentials.json) - For CI/CD, always use
--env-varwithclub setupto avoid storing tokens on disk