---
title: "Google OAuth callback"
method: GET
path: "/api/v2/auth/google/callback"
tags: ["v2 Auth"]
---

# Google OAuth callback

`GET /api/v2/auth/google/callback`

## Request

- Base URL: `https://pdf2md.dev`
- URL: `https://pdf2md.dev/api/v2/auth/google/callback`
- Auth: none required

Exchanges the code, upserts the account (email unique → a claimable account is auto-linked), sets the HttpOnly session cookie `p2m_session`, and, if `state` contains a device, links device→account and re-attaches the device's active jobs (owner_type=account_device). Returns an HTML success/error page.

## Query parameters

- `code` string
- `state` string
- `error` string

## Response `200`

Successful login (HTML)

## Other responses

- `400`: Invalid/expired state or code (HTML)
- `502`: Exchange error with Google (HTML)
- `503`: OAuth not configured

---

[API](https://skmtc.dev/pdf2md/apis/pdf-to-markdown-api-facade.md) · [All operations](https://skmtc.dev/pdf2md/apis/pdf-to-markdown-api-facade/llms.txt) · [OpenAPI document](https://skmtc.dev/pdf2md/apis/pdf-to-markdown-api-facade/revisions/4636782fb8b6?raw)
