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

> ## Agent Instructions
> Turnkey is wallet infrastructure: create and manage crypto wallets, sign transactions, and enforce policy-based access controls. Best-fit uses: embedded consumer wallets (email/passkey/social auth, no seed phrases), automated onchain operations with server-side wallets, AI agent wallets with policy-scoped signing, enterprise key management, and verifiable off-chain workloads on Turnkey Verifiable Cloud (TVC).
> Every API call is a JSON POST to https://api.turnkey.com signed with a P-256 API key; create an organization and key self-serve at https://app.turnkey.com.
> Key Turnkey developer resources: API reference (https://docs.turnkey.com/api-reference/overview/intro.md), OpenAPI spec (https://docs.turnkey.com/public_api.swagger.json), authentication (https://docs.turnkey.com/features/authentication/overview.md), webhooks (https://docs.turnkey.com/features/webhooks/overview.md), MCP server for docs search (https://docs.turnkey.com/mcp), skill for building with Turnkey (https://docs.turnkey.com/skill.md), agent skills for operating an organization (https://docs.turnkey.com/get-started/ai-skills.md), CLI (https://docs.turnkey.com/sdks/cli.md), SDK reference (https://docs.turnkey.com/sdks/introduction.md), full docs content (https://docs.turnkey.com/llms-full.txt).

# OAuth 2.0 Authenticate V2

> Submit encrypted OAuth 2.0 inputs through Auth Proxy and receive a Turnkey OIDC token.

`POST https://authproxy.turnkey.com/v1/oauth2_authenticate_v2`

## Authorization

Send `X-Auth-Proxy-Config-Id: <your Auth Proxy config ID>` and `Content-Type: application/json`. OAuth must be allowed in that proxy configuration. Follow the [Auth Proxy origin requirements](https://docs.turnkey.com/features/authentication/auth-proxy.md).

## Request body

```json theme={"system"}
{
  "oauth2CredentialId": "<credential UUID returned by initialization>",
  "encryptedMessage": "<serialized encrypted message returned by the helper>",
  "targetPublicKey": "<matching target public key returned by the helper>"
}
```

All three fields are required. First [initialize](https://docs.turnkey.com/api-reference/auth-proxy/init-oauth2-authenticate-v2.md), verify the target, and encrypt on the client. Encode `encryptedMessage` as a string, not a nested object. Don't include the legacy `authCode`, `codeVerifier`, or `nonce` fields; they travel inside `encryptedMessage`.

## Response

```json theme={"system"}
{
  "oidcToken": "<Turnkey OIDC token>"
}
```

Continue [OAuth Login](https://docs.turnkey.com/api-reference/auth-proxy/oauth-login.md) or signup with the same client session key you used to compute the nonce. See [Auth Proxy auth flows](https://docs.turnkey.com/features/authentication/auth-proxy.md#auth-flows) for the full sequence and the [encrypted payload](https://docs.turnkey.com/api-reference/activities/oauth-20-authentication-v2.md#encrypted-payload) for the fields to encrypt.


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