Skip to main content
oc handles authentication at two levels: OneCLI auth (your OneCLI instance) and plugin auth (service-specific credentials like Google OAuth tokens). OneCLI auth is the recommended path. Authenticate once, and oc fetches plugin credentials automatically.

OneCLI authentication

Log in

Interactive (opens browser):
This starts a browser-based sign-in flow. Once you authenticate, oc stores your token in your OS keychain. Device flow (for agents and headless environments):
The agent receives a URL to present to the user. Once the user authenticates in the browser, subsequent calls to oc will work. Direct token (if you already have one):

Check auth status

Log out

This removes your stored token from the keychain.

Plugin authentication

For plugins that support local auth, you can authenticate directly with the service:
The plugin runs its own OAuth or device flow. oc captures the resulting credentials and stores them securely.
Plugin auth commands are meta-commands: they run without requiring existing credentials. This lets you bootstrap auth from scratch.

How credential resolution works

When you run a plugin command like oc google calendar list-events, oc resolves credentials in this order:
1

Check for stored token

oc looks for a stored token (from oc auth login). If found, it requests plugin credentials from your OneCLI instance.
2

Fall back to local credentials

If no token exists, oc checks for locally stored credentials (from oc <plugin> auth).
3

Return an error with guidance

If neither source has credentials, oc returns exit code 2 with an action hint:

Credential storage and security

Credentials are stored using your OS keychain by default: If the keychain is unavailable, oc falls back to file-based storage at ~/.onecli/credentials/ with 0600 permissions (owner read/write only). What’s stored where:

Credential injection

When oc runs a plugin command, credentials are injected as environment variables. The plugin never reads credentials from files. It receives them from the parent process environment:
The naming convention is OC_{PLUGINNAME}_{FIELD}, with the plugin name and field uppercased.