---
title: "Firebase IDトークンをセッションCookieに交換する"
method: POST
path: "/api/v1/auth/session"
tags: ["auth"]
---

# Firebase IDトークンをセッションCookieに交換する

`POST /api/v1/auth/session`

## Request

- Base URL: `https://app.yukkurigen.com`
- URL: `https://app.yukkurigen.com/api/v1/auth/session`
- Auth: HTTP bearer

## Request body

- object
  - `idToken` string, required: Firebase Auth IDトークン

## Response `200`

セッションCookieをセット（HttpOnly / SameSite=Strict / 5日）

- object
  - `ok` boolean

## Other responses

- `400`: idToken が不正（code: validation_error）
- `401`: トークン検証失敗、またはログインから5分を超えた ID トークン（code: unauthenticated）。セッション Cookie はログインの直後にだけ発行する
- `415`: Content-Type が application/json でない（フォームからの送信は受けない）

---

[API](https://skmtc.dev/yukkurigen/apis/yukkurigen-ai-operated-api.md) · [All operations](https://skmtc.dev/yukkurigen/apis/yukkurigen-ai-operated-api/llms.txt) · [OpenAPI document](https://skmtc.dev/yukkurigen/apis/yukkurigen-ai-operated-api/revisions/ba5f36b016da?raw)
