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

# Claude Code

> Use authsome from inside Claude Code via the bundled skill. One login, then Claude runs your agents with fresh tokens for every provider.

[Claude Code](https://claude.com/claude-code) is Anthropic's CLI for coding agents. Authsome integrates with Claude Code through the `/anthropic-skills:authsome` skill. Once installed, Claude can log in to any provider, list connected services, and run agents that pull fresh credentials from the local vault.

<Note>
  **The agent drives login.** When Claude hits a missing credential it runs `authsome login <provider>` itself, opens a browser on your machine for OAuth consent, and picks up from there. Don't paste keys into prompts and don't pre-run login commands unless you're seeding a credential ahead of time.
</Note>

<Prompt description="**Set up authsome in Claude Code.** Paste this prompt to install the skill and authenticate a first provider." icon="rocket" iconType="solid" actions={["copy"]}>
  Install the authsome skill into Claude Code and log me into GitHub.

  1. Run `git clone https://github.com/agentrhq/authsome.git /tmp/authsome && mkdir -p ~/.claude/skills && cp -r /tmp/authsome/skills/authsome ~/.claude/skills/` to install the bundled skill.
  2. Then run `authsome login github` and walk me through approving the OAuth flow.
  3. After the login completes, run `authsome list` and report which providers are now connected.

  If anything fails, show me the exact error and `authsome doctor` output.
</Prompt>

## What the integration gives you

* **One login per service.** OAuth2 and API-key flows run from inside Claude Code. The skill drives the same `authsome login` commands a human would type.
* **No credentials in prompts or files.** Claude never sees raw tokens. The skill calls authsome, which collects secrets through a local browser bridge or the masked terminal fallback.
* **Automatic refresh.** Tokens stay fresh for every agent run Claude triggers. You do not re-authenticate when an access token expires.
* **The same vault.** Connections you create through the skill are stored in `~/.authsome/`, identical to connections created from the regular CLI. Nothing is duplicated.

## Install the skill

The authsome repository ships a Claude Code skill at `skills/authsome/SKILL.md`. Install it into your local Claude Code skills directory:

```bash theme={null}
git clone https://github.com/agentrhq/authsome.git /tmp/authsome
mkdir -p ~/.claude/skills
cp -r /tmp/authsome/skills/authsome ~/.claude/skills/
```

In Claude Code, invoke the skill by name once it's installed:

```text theme={null}
Use the authsome skill to log me into GitHub.
```

Claude will read the skill manifest and run the appropriate `authsome` commands. The skill teaches Claude the `list → login → run` flow plus authsome's safety rules (no `client_secret` in shell history, no `--scopes` workaround for missing access, etc.).

## First run

A typical first session looks like this:

<Steps>
  <Step title="Ask Claude what's already configured">
    ```text theme={null}
    /anthropic-skills:authsome list
    ```

    Claude runs `authsome list` and reports which providers are bundled, configured, and connected.
  </Step>

  <Step title="Log in to a provider">
    ```text theme={null}
    Log in to GitHub via authsome.
    ```

    Claude opens a browser to the OAuth2 PKCE flow. You approve the requested scopes, the callback lands on `http://127.0.0.1:7998/auth/callback/oauth`, and authsome stores the encrypted record.
  </Step>

  <Step title="Use the connection">
    ```text theme={null}
    Use authsome to fetch my last 5 GitHub notifications.
    ```

    Claude runs the agent under `authsome run`. The HTTP proxy injects the `Authorization` header at the `api.github.com` host. The agent's environment never contains the raw token.
  </Step>
</Steps>

## Common prompts

Concrete requests Claude understands. Each one maps to a specific authsome command.

| Prompt                                                    | What Claude runs                          |
| --------------------------------------------------------- | ----------------------------------------- |
| "Log me in to GitHub via authsome."                       | `authsome login github`                   |
| "Use the Resend API key from authsome to send an email."  | `authsome run -- python <script>`         |
| "Switch the active GitHub connection to my work account." | `authsome login github --connection work` |
| "Show me which providers are connected."                  | `authsome list`                           |
| "Revoke my OpenAI key."                                   | `authsome revoke openai`                  |
| "Add a custom provider for Acme CRM."                     | `authsome register ./acmecrm.json`        |

## Why this is the safe pattern

Without authsome, agents inside Claude Code typically read tokens from environment variables, `.env` files, or shell history. Each of those surfaces leaks easily:

| Pattern                   | Token visible in                                           |
| ------------------------- | ---------------------------------------------------------- |
| `export GITHUB_TOKEN=...` | `ps`, `/proc/<pid>/environ`, shell history, subprocess env |
| `.env` file in the repo   | The repo, backups, git history if committed by accident    |
| Manual paste into Claude  | Claude's transcript                                        |
| `authsome run -- ...`     | None of the above                                          |

`authsome run` is the recommended pattern for any Claude Code agent that calls third-party APIs. The child process never sees the real secret because the proxy injects headers at request time.

## Export when the proxy is not enough

```bash theme={null}
eval "$(authsome export github --connection default --format env)"
python my_agent.py
```

Or use the proxy without exporting:

```bash theme={null}
authsome run -- python my_agent.py
```

See [Python library reference](/reference/python-library) for the daemon HTTP API.

## Multi-account workflows

Most real workflows need at least two accounts (personal and work GitHub, or a personal and team OpenAI key). The skill plays well with named connections:

```text theme={null}
Log me into GitHub as my work account.
```

Claude runs:

```bash theme={null}
authsome login github --connection work
```

Read it back:

```text theme={null}
Use the work GitHub connection to open a PR.
```

Claude runs:

```bash theme={null}
authsome get github --connection work --field access_token --show-secret
```

## What the skill cannot do

* **It cannot type a `client_secret` for you.** Authsome refuses sensitive values as command-line arguments. The browser bridge is the only path.
* **It cannot bypass the proxy CA requirement.** HTTPS interception needs the mitmproxy CA trusted on the machine. The first `authsome run` writes the CA to `~/.mitmproxy/`. See [Proxy networking](/troubleshooting/proxy-networking).
* **It cannot share the vault across machines.** Claude Code on a second machine has its own `~/.authsome/`. Re-run logins there.

## Troubleshooting

If a Claude-driven login hangs:

* Run `authsome doctor` directly from the terminal to surface initialization errors.
* Run `authsome --verbose login <provider>` to see the full flow including the daemon round-trips.
* Run `authsome log` to inspect recent audit events from the daemon.

For provider-specific errors, see [OAuth callbacks](/troubleshooting/oauth-callbacks) and [Token refresh](/troubleshooting/token-refresh).

## What's next

<Columns cols={2}>
  <Card title="Run agents with the proxy" icon="shield-halved" href="/guides/run-agents-with-proxy">
    The proxy injection model the skill uses under the hood.
  </Card>

  <Card title="Python library" icon="code" href="/reference/python-library">
    Use `authsome export` or the daemon HTTP API when the proxy is not enough.
  </Card>

  <Card title="All bundled providers" icon="plug" href="/reference/bundled-providers">
    Every service Claude can log you into out of the box.
  </Card>

  <Card title="Custom providers" icon="puzzle-piece" href="/guides/custom-providers">
    Add a provider authsome doesn't ship.
  </Card>
</Columns>
