Skip to content

fix(auth): reject OAuth promise when login popup is closed - #1475

Open
SatyamPandey-07 wants to merge 1 commit into
RocketChat:developfrom
SatyamPandey-07:bugfix/oauth-popup-close-hang
Open

SatyamPandey-07 wants to merge 1 commit into
RocketChat:developfrom
SatyamPandey-07:bugfix/oauth-popup-close-hang

Conversation

@SatyamPandey-07

@SatyamPandey-07 SatyamPandey-07 commented Nov 29, 2026 •

Copy link
Copy Markdown

Related Issue

Fixes #1474

Changes Proposed

  • packages/auth/src/loginWithRocketChatOAuth.ts: Added reject handling and a settled guard in getRocketChatOAuthCredentials so that closing the OAuth popup before completion rejects the promise with "OAuth popup closed by user" instead of leaving it pending indefinitely.
  • packages/auth/src/loginWithRocketChatOAuth.ts: Extracted a shared cleanup() helper to immediately clear checkInterval and remove the window message listener on either resolution or rejection, and guarded e.data?.type and e.data.credentials against malformed same-origin postMessage events.

How Has This Been Tested?

  • Unit / integration tests in @embeddedchat/auth
  • Manual verification: Trigger loginWithRocketChatOAuth(), close the popup window, and confirm ChatInput.js onJoin catches the rejection and displays an error toast

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

@SatyamPandey-07

Copy link
Copy Markdown
Author

@abhinavkrin @Aryan-Verma-999 Hi, just bumping this PR in case it slipped through your notifications. Let me know if you need any changes or further testing!

This branch has not been deployed

No deployments
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.

OAuth Login Promise Hangs Indefinitely When User Closes Popup

1 participant