---
title: "Link GitHub or Google identity using login code"
method: POST
path: "/me/identities/oauth"
tags: ["Me"]
---

# Link GitHub or Google identity using login code

`POST /me/identities/oauth`

## Request

- Base URL: `https://console-api.blockvectra.com/v1`
- URL: `https://console-api.blockvectra.com/v1/me/identities/oauth`
- Auth: HTTP bearer

Exchange an OAuth login code and its PKCE verifier using the current session. Returns 201 for a new identity and 200 when already linked to this user.

## Request body

- OAuthTokenRequest
  - `code` string, required: Single-use login code delivered via callback redirect.
  - `code_verifier` string, required: PKCE verifier corresponding to `code_challenge` at start (RFC 7636).

## Response `200`

Identity already linked to this user (idempotent).

- IdentityView
  - `identity_id` string, required
  - `provider` 'siwe' | 'github' | 'google', required
  - `subject` string, required: SIWE: `eip155:1:<lowercase address>`; GitHub: numeric id; Google: `sub`.
  - `display` string, nullable, required: EIP-55 address for SIWE, login for GitHub (display only), null for Google.
  - `created_at` string, date-time, required: RFC 3339 UTC, second precision, ending in `Z` (`2026-09-26T08:00:00Z`); no fractional seconds, without `+00:00` timezone offsets.
  - `last_login_at` string, date-time, required: RFC 3339 UTC, second precision, ending in `Z` (`2026-09-26T08:00:00Z`); no fractional seconds, without `+00:00` timezone offsets.

## Other responses

- `201`: Newly linked identity.
- `400`: Invalid, reused login code, or verifier mismatch.
- `401`: Missing or invalid session (without distinguishing cause).
- `409`: Identity already linked to another user, or user already has 5 linked identities.
- `413`: Request body exceeds 64 KiB limit. Exceeding this limit returns 413 (`payload_too_large`).
- `429`: Rate limit exceeded.
- `500`: Internal server error.

---

[API](https://skmtc.dev/blockvectra/apis/blockvectra-console-api.md) · [All operations](https://skmtc.dev/blockvectra/apis/blockvectra-console-api/llms.txt) · [OpenAPI document](https://skmtc.dev/blockvectra/apis/blockvectra-console-api/revisions/28c91298f433?raw)
