> ## 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).

# Initialize OAuth 2.0 authentication

> Create a signed enclave encryption target for an OAuth 2.0 authentication exchange.

`POST https://api.turnkey.com/public/v1/submit/init_oauth2_authenticate`

Use normal signed [API authentication](https://docs.turnkey.com/api-reference/overview/stamps.md). Submit under the parent organization that owns the credential. This returns an encryption target, not an OIDC token or session.

## Request body

| Field | Required | Value |
| - | - | - |
| `type` | Yes | `ACTIVITY_TYPE_INIT_OAUTH2_AUTHENTICATE` |
| `timestampMs` | Yes | Current Unix timestamp in milliseconds, as a string |
| `organizationId` | Yes | Parent organization UUID |
| `parameters.oauth2CredentialId` | Yes | OAuth credential UUID belonging to that parent |
| `parameters.encryptionSuite` | Yes | `TRANSPORT_ENCRYPTION_SUITE_ENCLAVE_ENCRYPT_V2`, the only suite accepted for OAuth 2.0. It binds the ciphertext to the credential ID. |
| `generateAppProofs` | No | Boolean requesting App Proofs |

## Result

A completed activity contains `activity.result.initOauth2AuthenticateResult.enclaveTargetMessage`: the signed TLS Fetcher target message. SDKs may unwrap this result.

A target completes one exchange and expires after five minutes. Initialize a new target for each login attempt, near the code exchange, then verify and encrypt on the client using a supported helper. Keep the organization and credential consistent when submitting [OAuth 2.0 authentication V2](https://docs.turnkey.com/api-reference/activities/oauth-20-authentication-v2.md).

See [social logins](https://docs.turnkey.com/features/authentication/social-logins.md#authentication-sequence-diagrams) for the complete flow.


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