Skip to content

Handle errors on oauth desktop flow #294

Closed

Description

@AnthonyRonning

In the oauth desktop tauri flow, it kicks the user to the web to complete sign in and then should redirect after oauth is successful. However, if the oauth is successful but the actual 2nd part of the redirect of the login fails, it still says it's successful and will redirect. But the redirect doesn't happen, probably because it silently failed.

We need to make sure we handle errors on that web desktop redirect page for oauth. At least show that it errored.

Activity

  1. AnthonyRonning commented on Nov 2, 2025

    @AnthonyRonning
    ContributorAuthor

    @claude please look into this.

    It's specifically for desktop tauri login for oauth, then it redirects to the web, it completes the oauth handshake, goes back to maple's webpage after oauth redirect, gets the "Authentication successful! Redirecting you back to the app..." but it must have failed somewhere on this page/view and does nothing currently. It should show that there was a login error so the user doesn't think it'll be successful and wait there forever.

  2. claude commented on Nov 2, 2025

    @claude
    Contributor

    Claude finished @AnthonyRonning's task —— View job • claude/issue-294-20251102-2209 • Create PR ➔


    OAuth Desktop Flow Error Handling - Completed ✓

    I've successfully added error handling to the OAuth desktop redirect flow for Tauri.

    Tasks

    • Gather context: Find OAuth desktop redirect code
    • Identify the redirect page that shows "Authentication successful!"
    • Implement error handling for failed redirects
    • Add user-facing error messages
    • Run format, lint, and build
    • Commit and push changes
    • Create PR link

    Analysis

    Found the issue in auth.$provider.callback.tsx:38-80:

    Current behavior:

    • Sets redirect-to-native flag to indicate Tauri auth flow
    • Attempts deep link redirect: window.location.href = deepLinkUrl
    • If redirect fails, no error is caught - user sees "Authentication successful! Redirecting you back to the app..." indefinitely

    Root cause:
    The deep link redirect can fail silently if:

    • The deep link scheme isn't registered
    • Tauri app isn't available
    • Browser blocks the redirect

    Solution Implemented

    Changes to auth.$provider.callback.tsx:

    1. Added state management (lines 31-32):

      • redirectFailed: tracks if redirect failed
      • deepLinkUrl: stores the deep link for manual fallback
    2. Enhanced redirect with timeout detection (lines 59-78):

      • Set 5-second timeout to detect if user is still on page
      • Try-catch around window.location.href assignment
      • If redirect fails, show error UI instead of infinite loading
    3. New error UI (lines 179-216):

      • Shows clear error message: "Redirect Failed"
      • Provides manual "Open Maple App" button
      • Displays copyable deep link for manual browser paste
      • Includes "Back to Login" button for recovery

    User experience improvements:

    • ✅ Users no longer wait indefinitely
    • ✅ Clear error message when redirect fails
    • ✅ Manual fallback options provided
    • ✅ Can copy deep link and try in different browser

    Testing Recommendations

    To test this fix:

    1. Start OAuth flow in desktop Tauri app
    2. Complete OAuth on web
    3. If deep link fails, you'll now see error UI after 5 seconds
    4. Try "Open Maple App" button or copy deep link manually

    --- | Branch: claude/issue-294-20251102-2209

  3. added a commit that references this issue on Nov 2, 2025
    21f034d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions