---
title: "Oauth Callback"
method: GET
path: "/email/oauth/callback"
tags: ["email"]
---

# Oauth Callback

`GET /email/oauth/callback`

Handle Google OAuth redirect — exchange code, store connection, trigger scan.

Every failure past state verification redirects to the frontend with
`email_error`: the web flow runs this in a popup that only closes itself
from the page that redirect lands on, so an exception here would leave the
popup showing a bare 500 and the opener waiting forever.

## Query parameters

- `state` string, required
- `code` string, nullable
- `error` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

## Changes

- **2026-09-25** `f6559d3df7e9` — 4 info
  - added the new optional `query` request parameter `error`
  - the `query` request parameter `code` became optional
  - `query` request parameter `code` list-of-types was widened by adding types `null`
  - for the `query` request parameter `code`, the type was generalized from `string` to no type

[Change history](https://skmtc.dev/stardrift/apis/fastapi/changes/email/oauth/callback/get.md)

---

[API](https://skmtc.dev/stardrift/apis/fastapi.md) · [All operations](https://skmtc.dev/stardrift/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc.dev/stardrift/apis/fastapi/revisions/dd78fbd6c358?raw)
