Skip to content

routing issue - #3827

Merged
Baalmart merged 1 commit into
stagingfrom
device-serial
Jul 13, 2026
Merged

routing issue#3827
Baalmart merged 1 commit into
stagingfrom
device-serial

Conversation

@OlukaGibson

@OlukaGibson OlukaGibson commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes (What does this PR do?)

  • Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Status of maturity (all need to be checked before merging):

  • I've tested this locally
  • I consider this code done
  • This change ready to hit production in its current state
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included issue number in the "Closes #ISSUE-NUMBER" part of the "What are the relevant tickets?" section to link the issue.
  • I've updated corresponding documentation for the changes in this PR.
  • I have written unit and/or e2e tests for my change(s).

How should this be manually tested?

  • Please include the steps to be done inorder to setup and test this PR.

What are the relevant tickets?

Screenshots (optional)

Summary by CodeRabbit

  • Bug Fixes
    • Improved OAuth sign-in handoff handling.
    • Added a “Completing sign in…” loading state while authentication is finalized.
    • Prevented valid OAuth callback requests from being redirected to the login page.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

OAuth callback requests now bypass unauthenticated login redirects. AuthEffect tracks token handoffs, synchronizes session state after completion, and displays a loading screen while sign-in is being completed.

Changes

OAuth handoff flow

Layer / File(s) Summary
OAuth callback passthrough
src/beacon/middleware.ts
Middleware detects success or token query parameters and allows unauthenticated OAuth callbacks through without redirecting to /login.
Token handoff state and rendering
src/beacon/components/providers/auth-provider.tsx
AuthEffect tracks OAuth tokens in the URL hash, updates session synchronization dependencies, clears handoff state, and renders “Completing sign in...” during processing.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant middleware
  participant AuthEffect
  participant SessionSync
  Browser->>middleware: Request with OAuth callback parameters
  middleware-->>Browser: Allow callback without login redirect
  Browser->>AuthEffect: Load with OAuth token in URL hash
  AuthEffect->>SessionSync: Synchronize authentication and session state
  AuthEffect-->>Browser: Render Completing sign in...
  SessionSync-->>AuthEffect: Complete handoff
  AuthEffect-->>Browser: Render children
Loading

Possibly related PRs

Suggested reviewers: baalmart, baalmart

Poem

A token arrives on a callback flight,
Middleware keeps its pathway bright.
AuthEffect waits with a spinner’s glow,
Until session currents start to flow.
Then children return, sign-in complete.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is too vague to clearly describe the OAuth handoff and redirect fix in this changeset. Rename it to something specific, like "Fix OAuth callback redirect handling".
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch device-serial

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/beacon/components/providers/auth-provider.tsx (1)

38-46: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

isHandlingHandoff in the dependency array triggers a redundant re-run.

When setIsHandlingHandoff(false) fires on line 40, this effect re-runs (since isHandlingHandoff is in the deps). The second run finds isHandlingHandoff already false, skips the if-block, and does nothing useful. Consider removing isHandlingHandoff from the dependency array and resetting it in the handoff effect instead, or suppress the lint with a documented justification.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/beacon/components/providers/auth-provider.tsx` around lines 38 - 46,
Remove isHandlingHandoff from the dependency array of the session/status effect
to avoid its redundant rerun, and move the setIsHandlingHandoff(false) reset
into the handoff-specific effect where the handoff is completed. Preserve the
existing authentication token and user-data updates in the session/status
effect.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/beacon/components/providers/auth-provider.tsx`:
- Around line 11-16: Update the isHandlingHandoff initializer to parse
window.location.hash with URLSearchParams and check for OAUTH_FRAGMENT_TOKEN_KEY
using get, matching consumeOAuthTokenHandoffFromUrl. Preserve the existing
server-side false fallback and avoid substring-based token detection.

In `@src/beacon/middleware.ts`:
- Around line 40-44: Update OAuth callback detection in the middleware to accept
only the legitimate callback signal, rather than treating arbitrary `success` or
`token` query parameters as authorization. Remove the dead
`searchParams.has('token')` check and validate `success` against the expected
OAuth callback value or an additional trusted signal, while preserving client
handling of valid callbacks and redirects for unauthenticated protected
requests.

---

Nitpick comments:
In `@src/beacon/components/providers/auth-provider.tsx`:
- Around line 38-46: Remove isHandlingHandoff from the dependency array of the
session/status effect to avoid its redundant rerun, and move the
setIsHandlingHandoff(false) reset into the handoff-specific effect where the
handoff is completed. Preserve the existing authentication token and user-data
updates in the session/status effect.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: df49636e-d3d1-4abb-b6cf-a68c3288ad37

📥 Commits

Reviewing files that changed from the base of the PR and between 6afed48 and abe67ec.

📒 Files selected for processing (2)
  • src/beacon/components/providers/auth-provider.tsx
  • src/beacon/middleware.ts

Comment thread src/beacon/components/providers/auth-provider.tsx
Comment thread src/beacon/middleware.ts
@github-actions

Copy link
Copy Markdown
Contributor

New azure beacon changes available for preview here

@Baalmart
Baalmart merged commit 5417f56 into staging Jul 13, 2026
26 checks passed
@Baalmart
Baalmart deleted the device-serial branch July 13, 2026 20:26
@Baalmart Baalmart mentioned this pull request Jul 13, 2026
2 tasks
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.

2 participants