> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mallary.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Authenticate Mallary CLI with browser-based OAuth or an API key.

OAuth is the default for interactive use, including OpenClaw, Hermes, and other AI agent harnesses.

> [card] [Before using the Mallary CLI:](https://mallary.ai)
>
> <ol>
>   <li>Sign up at [https://mallary.ai](https://mallary.ai)</li>
>   <li>Connect your social media accounts in the Mallary dashboard</li>
>   <li>Sign in to the CLI with OAuth</li>
> </ol>

## Sign in with OAuth

```bash theme={null}
mallary auth login
```

The CLI shows a Mallary sign-in URL and a one-time code. Open the URL, sign in to Mallary, review the requested access, and approve it. OpenClaw, Hermes, and other agents do not need to receive your password, API key, access token, or refresh token.

One OAuth login gives the CLI all Mallary capabilities: view data, publish posts, reply to comments, and manage settings and connections. Users do not choose OAuth scopes, and no scope flags are needed. Nothing is posted or changed during login.

After setup, a clear request to publish, schedule, upload media for a requested post, or send a supplied reply is enough authorization to do it. The agent should not ask the user to approve the same action again. If a needed detail is missing or unclear, the agent should ask one short question. For destructive or account-access changes, it should confirm the target and effect only when the request did not already make them clear.

## Check or remove OAuth access

```bash theme={null}
mallary auth status
mallary auth logout
```

`auth status` reports whether OAuth or `MALLARY_API_KEY` is active without printing credentials. OAuth access tokens refresh automatically. `auth logout` revokes and removes the stored OAuth connection.

By default, OAuth credentials are stored outside the current project in the operating system's per-user application configuration directory. On macOS and Linux, the credentials file is restricted to the current user.

## API key alternative

API-key authentication remains available for CI and other environments where OAuth is not practical:

```bash theme={null}
export MALLARY_API_KEY="your_mallary_api_key"
```

When this variable is set, it takes precedence over stored OAuth credentials. Keep it in a masked secret store. Never commit it, paste it into an agent prompt, or print it in logs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.