Repository navigation
fix: treat a redirect with a Location header as webAuth - #1983
Open
HarshMN2345 wants to merge 2 commits into
Open
HarshMN2345 wants to merge 2 commits into
HarshMN2345 wants to merge 2 commits into
Conversation
Appwrite now declares its OAuth2 and VCS installation redirects as a 3xx with a Location header and no body. getMethodType only recognised the old shape, a 3xx with a binary body, so those methods fell back to plain API calls. The binary-body check stays for specs from older servers.
🟢 Tier S · Ready to merge
The pull request classifies redirect responses with a case-insensitive Location header as webAuth, retaining the binary-body fallback for older specs. It also adds a Web generation regression test that checks browser navigation output and equivalence with the legacy response shape. Latest changes: The newest commit adds a generation test for a bodyless redirect with a lowercase location header and compares its generated SDK with the legacy binary-body redirect.
📂 Walkthrough · 2
✅ Fixed since the last review · 1
Reviewed the commits since |
2 tasks done
HarshMN2345
added a commit
to appwrite/appwrite
that referenced
this pull request
Oct 7, 2026
This reverts commit b9d46a7. Redirects drop the body as #14155 requires. The generator that reads the Location header ships through appwrite/sdk-generator#1983 and is bumped on this branch.
cursor Bot
pushed a commit
to appwrite/appwrite
that referenced
this pull request
Oct 7, 2026
sdk-generator 5.0.1 only treats a 3xx binary body as webAuth. Lock the generator to appwrite/sdk-generator#1983 (e0bf097), which also accepts a Location header, and stop emitting that body on 301, 302 and 308.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisite for appwrite/appwrite#14192 (fixes appwrite/appwrite#14155).
What happens
appwrite/appwrite#14192 changes how the server spec declares its redirects.
createOAuth2Session,createOAuth2Tokenand the VCS installation authorize routes now return:instead of a 301 with a
text/htmlbinary body.getMethodTypeonly recognised the old shape, so on the new spec both OAuth2 methods come back asfalseinstead ofwebAuth. Client SDKs would call them as plain API requests instead of opening the browser.Fix
A 3xx response that declares a
Locationheader (case-insensitive, per OpenAPI) iswebAuth. The binary-body check stays, so specs from servers without appwrite/appwrite#14192 keep working.Verification
Both specs generated with
php app/cli.php specsfrom appwritemainand from the #14192 branch:webAuthlocationuploadgraphqlmainmainWeb, Flutter, Android and React Native generated from the #14192 spec with this branch are byte-identical to the same SDKs generated from the
mainspec. Apple differs only in the unusedacceptheader inside the two webAuth methods (text/html→application/json); those methods open the URL inWebAuthComponentand never send it.testRedirectWithLocationIsWebAuthgenerates Web from a 301 with a lowercaselocationheader and asserts the browser redirect, then asserts the legacy binary-body document generates the same files. It fails without theLanguage.phpchange.tests/resources/spec-openapi3.jsonis unchanged:generalRedirect(301, noLocation) stays a plain call andgeneralOauth2stayswebAuth.phpcs,rector --dry-runand the Generation suite pass.