Repository navigation
Read the app JWT from X-Refetch-JWT; Cloud's executor overwrites Authorization - #14
Merged
Merged
Conversation
On Appwrite Cloud the edge executor overwrites the request's Authorization header with its own `Basic opr:<secret>` (edge src/Edge/K8s/Runner.php) before it reaches the site, so the app's Bearer token never arrived and every /api/app/* call answered 401. Verified from the app: the same JWT returns 200 from Appwrite's /v1/account but 401 from /api/app/session. The routes now read the JWT from X-Refetch-JWT and keep Bearer only as a fallback for local runs without the proxy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RefetchProject ID: Functions (4)
Tip Environment variable changes require redeployment to take effect |
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.


Follow-up to #13. Every
/api/app/*call from the app answered 401 in production, although the same calls worked locally.Root cause
On Appwrite Cloud the edge executor overwrites the request's
Authorizationheader with its ownBasic opr:<secret>credential before the request reaches the site (edgesrc/Edge/K8s/Runner.php). The app'sBearer <jwt>never arrives. Verified from the app on a phone: the same JWT returns 200 from Appwrite's/v1/accountand 401 fromhttps://refetch.io/api/app/session. The website is unaffected becauseestablishSessiontakes the JWT in the request body.Fix
The routes read the JWT from
X-Refetch-JWT(appTokeninsrc/lib/app-api.ts), falling back toAuthorization: Bearerfor local runs without the proxy.docs/APP_API.mdupdated. The app sends the new header in refetch-io/refetch_flutter (fix/app-jwt-header).Checks
pnpm test: 127 passed (5 new forappToken, including the executor's Basic credential being ignored)pnpm typecheck: clean🤖 Generated with Claude Code