Declare the Location header on OAuth2 redirect responses in the OpenAPI spec
維護者通常 1 天內回覆
評估
研究方向
從 src/Appwrite/SDK/Specification/Format/OpenAPI3.php 開始,特別注意 504-512 行與 547-552 行附近的響應處理。追蹤兩個具名的 OAuth2 操作如何產生 301 響應,接著檢查 204、302 與 308 響應的處理方式。完成條件為:兩個 301 響應都宣告了指定的無內容 Location 標頭,204 響應維持不變,且該規範可通過 OpenAPI 3.0 驗證。
由索引模型根據 Issue 內容生成。
描述
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 Objectheaders). - 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
contentbecause the route's content type is HTML. - Lines ~547-552 set the description to "No content" for 204/301/302/308 and drop
contentonly 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.
getMethodTypemust switch to "3xx with aLocationheader" in the same release as this change, otherwise SDKs stop classifying these methods aswebAuth. x-appwriteextensions, security schemes, and any other spec changes.
Acceptance criteria
- Both operations'
301responses haveheaders.Locationwithtype: string, format: uri, and nocontent. - The description is no longer "No content" for 3xx responses.
- 204 responses are unchanged.
- The spec validates as OpenAPI 3.0.
- 主要語言
- TypeScript
- 星號
- 57.9k
- 分支
- 5.8k
- 平均合併
- 16 小時 1 分鐘
- 30 天內合併 PR
- 768
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
appwrite/appwrite 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
appwrite/appwrite#15707 · 1 則留言 ·
維護者通常 1 天內回覆
-
Cloud console cannot load details page of function named "Create"可能重新可做 @priyas1672 於 7 天前認領,目前沒有進行中的 PR。 未關閉product / console product / functions
難度 2/5 1-3 小時 新手友好度 63/100
appwrite/appwrite#15344 · 3 則留言 ·
維護者通常 1 天內回覆
-
/health endpoint documentation missing since v1.9.x可能重新可做 @shahinsamiur 於 20 天前認領,目前沒有進行中的 PR。 未關閉product / databases
難度 2/5 1-3 小時 新手友好度 72/100
appwrite/appwrite#15005 · 3 則留言 ·
維護者通常 1 天內回覆
-
Locale currencies list offers only withdrawn codes for Belarus, Venezuela and Zambia可能已有人在做 @MateenAkram1 於 29 天前認領。 未關閉product / locale
難度 2/5 1-3 小時 新手友好度 78/100
appwrite/appwrite#14627 · 2 則留言 ·
維護者通常 1 天內回覆
查看 appwrite/appwrite 的全部 Issue
相似的 Issue
-
agent-ready area: ui-server priority: p3 type: test
難度 2/5 1-3 小時 新手友好度 78/100
schlessera/brain-kit#4249 ·
維護者通常 1 天內回覆
-
documentation tool triaged
難度 2/5 1-3 小時 新手友好度 73/100
can1357/oh-my-pi#19608 · 2 則留言 ·
維護者通常 1 天內回覆
-
dependencies tech-debt
難度 2/5 1-3 小時 新手友好度 65/100
bcgov/nr-waste-plus#1549 ·
維護者通常 1 天內回覆
-
enhancement good first issue
難度 2/5 1-3 小時 新手友好度 78/100
blixvip/solana-token-meta#17 ·
-
enhancement good first issue
難度 2/5 1-3 小時 新手友好度 78/100
blixvip/solana-tx-parse#18 ·