Sign in
On this page

Authentication

Authenticate modcloud CLI with a personal API token.

Create an API token

In the panel, open the CLI page and create a token in the API Tokens tab. Choose only the scopes required by the commands you plan to run. The raw token is displayed once when it is created, so copy it to a secure location.

Log in with a token

Pass a token directly to the login command. The CLI validates it against the account endpoint and saves it to the local configuration file.

Code
modvc login --token mvc_your_token_here

For non-interactive commands, the credential lookup order is the--token option, the MODVC_TOKEN environment variable, then the saved token.

Browser device login

Run modvc login. The terminal displays a confirmation code and verification URL, then tries to open the URL in your browser. Sign in if asked, check the displayed device details, and approve or deny the request. The URL includes the code, in the formhttps://dash.modcloud.dev/cli-auth?code=ABCD-2345. The CLI polls every 3 seconds and uses the longer interval returned withslow_down (currently 5 seconds).

On approval, the browser says the device is connected and that you can return to the terminal. The terminal reports the account email and saves the credential. If the request is denied or expires, the browser shows that state and the terminal stops polling immediately. A pending request expires after 10 minutes.

Switch accounts

Device login displays the authorized account's email in the terminal. Withmodvc login --switch, the existing credentials remain active until the new request is approved. Approval updates the active token, email, and API URL, while merging the new account into the saved profiles; the old profile is retained.

Code
modvc login --switch
modvc accounts
modvc switch [email protected]

Use modvc accounts (alsomodvc profiles) to list saved accounts, thenmodvc switch <email> to activate one. To log out, runmodvc logout; it attempts to revoke the active token and clears the active credential fields locally, but saved profiles remain.

Local configuration

The default file is ~/.modvc/config.json on Linux and macOS, and %USERPROFILE%\.modvc\config.json on Windows. SetMODVC_CONFIG_DIR to use a different directory. The JSON stores the active token, account email, API URL, and saved profile entries, including their tokens.

On Linux and macOS, the CLI creates the configuration directory with mode0700 and writes the file with mode0600; it also attempts to apply those modes to existing paths when loading them. To reapply the file mode manually, run:

Code
chmod 600 ~/.modvc/config.json

On Windows, the CLI does not set a restrictive file ACL; access follows the inherited Windows permissions. Restrict access to the file using your Windows account and file security settings.