Skip to content

Add error-state handling for a failed OAuth callback in src/features/auth/pages/AuthCallbackPage.tsx #493

Description

@Jagadeeshftw

📌 Description

src/features/auth/pages/AuthCallbackPage.tsx handles the redirect back from GitHub OAuth. If the backend callback (internal/handlers/github_oauth.go) returns an error (denied consent, expired state, backend failure), this page needs a clear error UI rather than an infinite spinner or a blank screen, which is what typically happens when only the happy path is implemented.

🧩 Requirements and context

  • Add explicit handling for an error query param / failed API response on mount.
  • Show a clear, actionable error message with a way to retry sign-in, distinct from the loading state.
  • Add a test for the error-param and network-failure paths, not just the success path.

Non-functional requirements

  • Must be secure, tested, and documented.
  • Should be efficient and easy to review.

🛠️ Suggested execution

1. Fork the repo and create a branch

git checkout -b fix/auth-callback-error-state

2. Implement changes

  • Modify: src/features/auth/pages/AuthCallbackPage.tsx — add error branch with a retry CTA.
  • Add test: new test file covering error and network-failure scenarios.

3. Test and commit

  • Run tests:
npm test -- run AuthCallbackPage
  • Cover edge cases: GitHub returns an error param (user denied consent), backend session exchange fails with a 500, network failure during the callback request, user double-navigates back to this page after already completing auth.
  • Include test output and details in the PR description.

Example commit message

fix: add error-state UI for failed OAuth callback

✅ Acceptance criteria

  • A denied-consent or backend-failure callback shows a clear error state with a retry option, not an infinite spinner.
  • Navigating back to this page after a completed auth doesn't get stuck.
  • The happy-path success flow is unaffected.

🔒 Security notes

An error state that silently hangs could mask a real backend issue (e.g. state-mismatch CSRF rejection) from the user — surfacing it clearly also makes it easier to notice abuse attempts during support triage.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial Campaign | FWC26GrantFox official campaign issuebugSomething isn't workingfrontendFrontend / UI work

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions