Repository navigation
Description
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.
Activity
fix(openapi): declare Location on OAuth2 redirect responses
Revert "fix(openapi): keep the binary redirect body for webAuth"
Juanmidev1 commentedon Nov 11, 2026
I'd like to work on this issue.
I know the contributing guide recommends starting with a
good first issue, but there are currently none open in this repo, and thehelp wantedones are all being requested by several people and need changes across multiple repos. This issue is small and well scoped (theLocationheader and the "No content" description inOpenAPI3.php), so it looked like a good way to get started.Could you assign it to me?