Declare the Location header on OAuth2 redirect responses in the OpenAPI spec

Aperta Adatta ai principianti
#14,155 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@HarshMN2345 ci sta già lavorando.

Dal 7/10/2026.

  • #1983 di @HarshMN2345 — aperta
  • #14192 di @HarshMN2345 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
openapi, php
Ambito
api

Direzione di ricerca

Inizia in src/Appwrite/SDK/Specification/Format/OpenAPI3.php, in particolare nella gestione delle risposte intorno alle righe 504-512 e 547-552. Traccia come le due operazioni OAuth2 denominate generano le loro risposte 301, poi controlla come vengono gestite le risposte 204, 302 e 308. Fatto significa che entrambe le risposte 301 dichiarano l'intestazione Location specificata senza contenuto, le risposte 204 rimangono invariate e la specifica viene validata come OpenAPI 3.0.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

product / auth product / databases product / messaging product / sites sdk / cli

Summary

The OpenAPI 3 spec describes the two OAuth2 redirect endpoints as returning an HTML body with no destination. A 301 is a redirect, and the part a client needs is the Location header. This issue covers declaring the redirect properly in the spec, using only standard OpenAPI fields.

Affected operations (the only 3xx operations in the 2.3.x spec):

  • GET /account/sessions/oauth2/{provider} (createOAuth2Session)
  • GET /account/tokens/oauth2/{provider} (createOAuth2Token)

Current

"responses": {
  "301": {
    "description": "No content",
    "content": {
      "text/html": {
        "schema": {
          "type": "string",
          "format": "binary"
        }
      }
    }
  }
}

Proposed

"responses": {
  "301": {
    "description": "Redirect to the OAuth2 provider's sign-in page.",
    "headers": {
      "Location": {
        "description": "URL of the OAuth2 provider's authorization page.",
        "schema": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}
  • Drop content. The body of a redirect is not part of the API.
  • Add headers.Location (OpenAPI 3.0 Response Object headers).
  • Replace the "No content" description with one that says what the response does.

Where

src/Appwrite/SDK/Specification/Format/OpenAPI3.php:

  • Lines ~504-512 add the binary content because the route's content type is HTML.
  • Lines ~547-552 set the description to "No content" for 204/301/302/308 and drop content only for 204.

For 301, 302 and 308, drop content as for 204, and emit the Location header.

Why

sdk-generator currently has to infer that these methods are browser redirects from the response shape: a 3xx with a non-JSON binary body (Language::getMethodType). Declaring the Location header states it directly, so generators and other OpenAPI tooling can treat these operations as redirects without guessing.

Context: server SDKs currently request these URLs themselves instead of returning them for the browser to open. Since #14012 that breaks server-started OAuth2 sign-in with user_oauth2_state_invalid, because the nonce cookie never reaches the browser. That SDK fix is tracked separately. This issue only covers the spec.

Out of scope

  • sdk-generator changes. getMethodType must switch to "3xx with a Location header" in the same release as this change, otherwise SDKs stop classifying these methods as webAuth.
  • x-appwrite extensions, security schemes, and any other spec changes.

Acceptance criteria

  • Both operations' 301 responses have headers.Location with type: string, format: uri, and no content.
  • The description is no longer "No content" for 3xx responses.
  • 204 responses are unchanged.
  • The spec validates as OpenAPI 3.0.
Lingua principale
TypeScript
Stelle
57.9k
Fork
5.8k
Merge medio
16h 1m
PR unite (30g)
768

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di appwrite/appwrite

Tutte le issue di appwrite/appwrite

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.