Skip to main content

Overview

Anthropic does not support third-party OAuth, so Claude can’t use Formal linked accounts. You can still keep each user on their own Claude account without leaving usable tokens on their laptop. Each user signs in to Claude Code with their own claude.ai account. Formal then seals the OAuth tokens Anthropic returns:
  1. An encrypt encrypts access_token and refresh_token in the response from platform.claude.com.
  2. Claude Code stores formalsealed:... values instead of plaintext tokens.
  3. A decrypt policy decrypts the Authorization header before the request reaches Anthropic. It also decrypts the refresh token when Claude Code refreshes or revokes it.
A sealed token that is copied off the device can’t be used against Anthropic directly. This guide uses the Formal Endpoint Transparent Mode on macOS, which encrypts with the device Secure Enclave.
Endpoint encrypt is macOS-only. On other platforms, forward this traffic to a with a token encryption key. See Encrypt on the Connector.

Intercept Anthropic traffic

Claude Code signs in through platform.claude.com and calls api.anthropic.com and mcp-proxy.anthropic.com. A network rule sends all three through the Endpoint.
1

Enable Transparent Mode

Verify: the status command reports that Transparent Mode is running.
2

Create the network rule

  1. Navigate to Network Rules
  2. Create a rule named claude-oauth
  3. Paste the CEL below
  4. Leave Forward to Connector unset
  5. Save the rule and set it to Active
Verify: run claude -p "test" and confirm the request appears in Logs.

Encrypt the OAuth tokens

This policy encrypts the tokens in every OAuth response from platform.claude.com.
  1. Navigate to Policies
  2. Click Create Policy
  3. Set name to claude-encrypt-oauth and add a description
  4. Paste the Rego below into the editor
  5. Click Create Policy to save, then set the policy to Active

Decrypt the tokens for Anthropic

This policy has two rules. The first decrypts Authorization on API and MCP proxy requests. The second decrypts the refresh token when Claude Code refreshes or revokes it.
  1. Navigate to Policies
  2. Click Create Policy
  3. Set name to claude-decrypt-oauth and add a description
  4. Paste the Rego below into the editor
  5. Click Create Policy to save, then set the policy to Active
Encrypt is fail-closed. If encryption fails, Formal blocks the token response. If decryption fails, Formal forwards the request unchanged.

Verify end to end

Tokens issued before the policies were active are still plaintext. Sign out and sign in again with Transparent Mode running:
Confirm Claude Code stored sealed tokens:
Confirm Anthropic accepts the decrypted token:
Pair this guide with Restrict Anthropic Sign-Ins. Then users can sign in only with accounts in your Anthropic organization.

Troubleshooting

Possible causes:
  • Transparent Mode or the network rule is inactive
  • The device is not macOS, so the Endpoint can’t encrypt
  • You signed in before the encrypt policy was active
Fix:
  1. Run formal transparent-proxy status
  2. Set the network rule and both policies to Active
  3. On Linux or Windows, forward the traffic to a Connector with a token encryption key
  4. Run claude auth logout and claude auth login again
Possible causes:
  • Encrypt ran, but the decrypt policy is inactive or doesn’t match the hostname
  • The sealed token came from another device or Formal user
Fix:
  1. Confirm claude-decrypt-oauth is Active and matches api.anthropic.com and mcp-proxy.anthropic.com
  2. Sign out and sign in again on this device

Next Steps

Restrict Anthropic Sign-Ins

Allow only your Anthropic organization

Encrypt MCP OAuth Tokens

Apply the same pattern to MCP servers

Encrypt & Decrypt

Full action reference

Token Encryption

Encrypt on the Connector with a KMS key