---
title: "Oauth Authorize Post"
method: POST
path: "/oauth/authorize"
tags: ["OAuth"]
---

# Oauth Authorize Post

`POST /oauth/authorize`

## Request

- Base URL: `https://logfire-api.pydantic.dev/api`
- URL: `https://logfire-api.pydantic.dev/api/oauth/authorize`
- Auth: none declared
- TypeScript: <https://skmtc.dev/pydantic/apis/pydantic-logfire-api/docs/oauth/authorize/post.ts> (a function with typed inputs; its response is checked against the schema)

OAuth 2.0 authorization endpoint (POST).

This endpoint receives the user's consent (with selected organization and project)
and generates an authorization code.

RFC 8707: The `resource` parameter identifies the target resource server.

When called with Accept: application/json, returns the redirect URL as JSON
instead of a 303 redirect. This avoids CSP form-action restrictions that block
cross-origin redirects in the OAuth flow's redirect chain.

## Cookies

- `logfire_token` string, password, nullable

## Request body `application/x-www-form-urlencoded`

- BodyOauthAuthorizePostOauthAuthorizePost
  - `client_id` string, required
  - `redirect_uri` string, required
  - `scope` string, required
  - `organization_id` string, uuid, required
  - `project_id` string, uuid, nullable
  - `state` string, nullable
  - `code_challenge` string, nullable
  - `code_challenge_method` string, nullable
  - `resource` string, nullable
  - `csrf_token` string, password, nullable
  - `claims` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/pydantic/apis/pydantic-logfire-api.md) - [All operations](https://skmtc.dev/pydantic/apis/pydantic-logfire-api/llms.txt) - [OpenAPI document](https://skmtc.dev/pydantic/apis/pydantic-logfire-api/revisions/7996e45256f4?raw)
