Skip to content

fix(flutter): surface OAuth failure errors from callback URL - #1829

Merged
ChiragAgg5k merged 1 commit into
mainfrom
fix-1827-flutter-oauth-error-callback
Aug 22, 2026
Merged

fix(flutter): surface OAuth failure errors from callback URL#1829
ChiragAgg5k merged 1 commit into
mainfrom
fix-1827-flutter-oauth-error-callback

Conversation

@cursor

@cursor cursor Bot commented Aug 22, 2026

Copy link
Copy Markdown

Summary

When an OAuth login fails (e.g. user_already_exists), the failure relay deep-links back to the Flutter app with an error query param and no session key/secret. The Flutter client previously threw a generic "Invalid OAuth2 Response" exception instead of the real Appwrite error.

This parses the error JSON from the callback URL and throws AppwriteException with the original message, type, and code.

Fixes #1827
Related to appwrite/appwrite#13308

Test plan

  • Regenerate Flutter SDK and confirm client_io.dart includes the new error parsing
  • On a Flutter mobile app, trigger OAuth against an account that already exists
  • Confirm the browser/webview closes and the thrown exception type is user_already_exists (not "Missing redirect URL" / generic invalid OAuth response)
  • Confirm successful OAuth login still sets the session cookie as before

Notes

Self-hosted 1.9.6 still omits project on the default failure relay URL (fixed on main in appwrite#12976). That separate server fix is required for the deep-link to reach the app when failure is omitted; this PR covers correct error surfacing once the callback returns.

Open in Web View Automation 

When the OAuth failure relay deep-links back without key/secret, parse
the error query param and throw AppwriteException with the real type
(e.g. user_already_exists) instead of a generic invalid-response error.

Fixes #1827
Related to appwrite/appwrite#13308

Co-authored-by: chiragaggarwal5k <chiragaggarwal5k@gmail.com>
@cursor
cursor Bot requested a review from ChiragAgg5k August 22, 2026 03:38
@cursor
cursor Bot marked this pull request as ready for review August 22, 2026 03:38
@greptile-apps

greptile-apps Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR updates Flutter’s I/O client template to surface OAuth callback failures as generated Appwrite exceptions instead of generic invalid-response errors.

  • Imports Dart JSON decoding support.
  • Parses structured callback errors into message, code, type, and raw response fields.
  • Preserves plain-string and generic invalid-response fallbacks.

Confidence Score: 5/5

The PR appears safe to merge with no concrete blocking or non-blocking issues identified.

The new branch is limited to callbacks missing session credentials, preserves malformed and plain-string error handling, and constructs exceptions using the established generated exception argument order.

Important Files Changed

Filename Overview
templates/flutter/lib/src/client_io.dart.twig Adds guarded OAuth error decoding while preserving successful session handling and fallback behavior; no actionable defect was identified.

Reviews (1): Last reviewed commit: "fix(flutter): surface OAuth failure erro..." | Re-trigger Greptile

@ChiragAgg5k
ChiragAgg5k merged commit 8aee60c into main Aug 22, 2026
58 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix-1827-flutter-oauth-error-callback branch August 22, 2026 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug Report: OAuth Missing redirect URL

2 participants