---
title: "Authorize Grant"
method: POST
path: "/oauth/authorize/grant"
tags: ["OAuth"]
---

# Authorize Grant

`POST /oauth/authorize/grant`

## Request

- Base URL: `https://api.emile.wine` (the document declares no server; this is the origin it was published from)
- URL: `https://api.emile.wine/oauth/authorize/grant`
- Auth: HTTP bearer

Called by the consent UI after the user clicks "Autoriser". The
Supabase JWT identifies which user is granting consent. Returns the
redirect URL with the freshly-issued code.

## Headers

- `X-API-Key` string, nullable

## Request body

- GrantRequest
  - `client_id` string, required
  - `redirect_uri` string, required
  - `scope` string
  - `state` string, nullable
  - `code_challenge` string, nullable
  - `code_challenge_method` string, nullable

## Response `200`

Successful Response

- GrantResponse: Returned to the consent UI's fetch() call. The browser then does `window.location = redirect_to` to bounce back to the store. Server-side redirect would also work but it requires the consent UI to be on the same origin, which it isn't.
  - `redirect_to` string, required

## Other responses

- `422`: Validation Error

---

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