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

# Migrate with an AI agent

> Install the V2 to V3 migration skill so your coding agent updates your codebase from V2 to V3.

The `ofauth-v2-to-v3-migration` skill teaches a coding agent (Claude Code, Codex, Cursor, or any Agent Skills-compatible client) how to move your codebase from OFAuth V2 to V3. It follows the [V2 to V3 migration guide](https://docs.ofauth.com/v3/guides/migrate-v2-to-v3.md) and the current V3 API reference.

The skill updates your application code only. You still run the organization cutover in the OFAuth dashboard.

## What the agent does

1. **Audits V2 usage.** Searches for API keys (`sk_live_...`, `sk_sandbox_...`), `/v2/*` routes and the raw access proxy, `x-connection-id`, Link embed and `/v2/link/init`, `/v2/account*`, `/v2/vault-plus`, V2 SDKs, and webhook receivers reading `svix-*` headers.
2. **Plans the migration.** Maps each V2 call to its V3 operation and required read/write scope, flags removed V2 features, and shows you the plan before making large edits.
3. **Rewrites the integration.** Implements OAuth 2.0 + S256 PKCE at `https://link.ofauth.com/v3/authorize`, token exchange at `https://api.ofauth.com/v3/link/token`, stable refresh-token storage per `linked_account_id`, `/v3/access/*` with `x-linked-account-id`, `/v3/vault-plus/*`, `/v3/linked-accounts`, Standard Webhooks headers (`webhook-*`), V3 lifecycle events, and SSE Realtime where used.
4. **Builds the account bundle import.** Creates an idempotent import script for the post-cutover `ofauth.migrated-accounts.v1` JSON bundle.
5. **Verifies.** Runs your test suite, checks that no V2 calls remain, and walks you through Test rehearsal and cutover day.

## Install the skill

Run the install command from your repository root (on Windows, use Git Bash or WSL):

> [tab] Claude Code
>
> ```bash theme={null}
> base=https://ofauth.com/skills/ofauth-v2-to-v3-migration dir=.claude/skills/ofauth-v2-to-v3-migration; curl -fsSL "$base/files.txt" | while read -r f; do curl -fsSL --create-dirs -o "$dir/$f" "$base/$f" || exit 1; done
> ```
>
> To install globally for every project, set `dir=~/.claude/skills/ofauth-v2-to-v3-migration`.

> [tab] Codex and others
>
> ```bash theme={null}
> base=https://ofauth.com/skills/ofauth-v2-to-v3-migration dir=.agents/skills/ofauth-v2-to-v3-migration; curl -fsSL "$base/files.txt" | while read -r f; do curl -fsSL --create-dirs -o "$dir/$f" "$base/$f" || exit 1; done
> ```
>
> If your agent does not automatically load `.agents/skills/`, add this line to `AGENTS.md`:
>
> ```markdown theme={null}
> When migrating OFAuth from V2 to V3, follow .agents/skills/ofauth-v2-to-v3-migration/SKILL.md and read the reference files it links.
> ```

> [tab] Cursor
>
> Download the files with the **Codex and others** command, then add `.cursor/rules/ofauth-v2-to-v3-migration.mdc`:
>
> ```markdown theme={null}
> ---
> description: Migrating the OFAuth integration from V2 to V3
> globs:
> alwaysApply: false
> ---
> When migrating OFAuth from V2 to V3, follow .agents/skills/ofauth-v2-to-v3-migration/SKILL.md and read the reference files it links.
> ```

## Start the migration

Open your coding agent in the repository and paste:

```text theme={null}
Migrate this codebase from OFAuth V2 to V3 using the ofauth-v2-to-v3-migration skill. Start by finding every V2 usage and show me the plan before you edit code. Build the account bundle import too. Do not add real secrets to any file.
```

Steps only you should run:

* Run the organization migration in the OFAuth dashboard, review Live callbacks, and save the Live client secret.
* Configure your Sandbox, Test, and Live client IDs, client secrets, and webhook secret in your secret manager.
* Run the Test rehearsal and verify Live client credentials.
* After cutover, download the one-time account bundle and run the import script yourself.

## Safety

> [!WARNING]
>
> The account bundle holds one refresh token for each migrated account. Treat it like your client secret: never commit it, paste it into an agent chat, or share it. Run the import yourself, then delete the file. If you lose it, an owner can regenerate it, which revokes every token from the previous bundle.

* Review every diff before merging, especially token storage, the OAuth callback, and webhook verification.
* Keep secrets in your secret manager or environment variables — never in code, fixtures, or prompts.
* If your app uses a V2 route with no V3 operation, or a raw proxy path, contact [support@ofauth.com](mailto:support@ofauth.com) before scheduling cutover.


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