OAuth Login Promise Hangs Indefinitely When User Closes Popup
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- javascript, react
- Domaine
- authentication, frontend
Piste de recherche
Start with packages/auth/src/loginWithRocketChatOAuth.ts, especially getRocketChatOAuthCredentials and its popup polling and message listener. Check the existing auth tests for coverage of OAuth popup callbacks and cancellation. Done when closing the popup rejects the promise, callback handling cleans up its listeners and interval, and malformed message data does not cause an error.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Description
When authenticating via loginWithRocketChatOAuth(), getRocketChatOAuthCredentials in packages/auth/src/loginWithRocketChatOAuth.ts creates a Promise that only accepts resolve and never rejects if the user closes the OAuth popup window manually. Additionally, e.data.type is accessed without optional chaining and the interval/event listener are not immediately cleaned up when rc-oauth-callback is received.
Steps to Reproduce
- Configure EmbeddedChat with
authFlow: 'OAUTH'. - Click the Join / Sign in with Rocket.Chat OAuth button (triggers
onJoininpackages/react/src/views/ChatInput/ChatInput.js, which callsawait RCInstance.auth.loginWithRocketChatOAuth()). - Close the opened OAuth popup window manually without completing authentication.
- Observe that the
awaitnever resolves or rejects, and no error toast or recovery state is triggered.
Expected Behavior
Closing the OAuth popup before authentication completes should clean up the polling interval and message event listener and reject the returned Promise with a descriptive error (e.g., "OAuth popup closed by user"), allowing callers' try/catch blocks to handle the cancellation.
Actual Behavior / Error Logs
No error is thrown; `getRocketChatOAuthCredentials` in `packages/auth/src/loginWithRocketChatOAuth.ts` (lines 45-67) clears `checkInterval` and removes the `message` listener when `popup.closed` is true, leaving the Promise permanently in a `pending` state.
Proposed Fix
Update getRocketChatOAuthCredentials in packages/auth/src/loginWithRocketChatOAuth.ts:
- Add
rejectto thePromiseexecutor and track asettledflag to prevent double-settlement. - Extract a shared
cleanup()helper to callclearInterval(checkInterval)andwindow.removeEventListener("message", onMessage). - Call
cleanup()andreject(new Error("OAuth popup closed by user"))whenpopup.closedis detected before settlement. - Call
cleanup()immediately whenrc-oauth-callbackresolves, and usee.data?.type === "rc-oauth-callback"to guard against null/non-objectpostMessagepayloads.
- Langage dominant
- JavaScript
- Étoiles
- 171
- Forks
- 421
- Merge moyen
- 3 j 6 h
- PR mergées (30 j)
- 4
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de RocketChat/EmbeddedChat
-
Bug: username fallback in updateUserUsername never runs since the ddp-client migrationPeut-être pris @MuhammadFaizan-prog l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
RocketChat/EmbeddedChat#1489 ·
Les mainteneurs répondent en général sous 1 jour
-
[Bug]: Low contrast on color swatch borders in Theme Lab (Layout Editor)Peut-être pris @yashsarvaiya45 l’a pris aujourd’hui. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 79/100
RocketChat/EmbeddedChat#1486 ·
Les mainteneurs répondent en général sous 1 jour
-
bug(api): _doConnect swallows connection/auth errors and marks failed sessions as authenticatedPeut-être pris @ashwanisingh011 l’a pris il y a 1 jour. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
RocketChat/EmbeddedChat#1484 ·
Les mainteneurs répondent en général sous 1 jour
-
Bug: White screen crash (`Cannot read properties of undefined (reading 'members')`) when rendering UserMention outside MarkupInteractionContextPeut-être pris @swarnendusahu10-dotcom l’a pris il y a 2 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
RocketChat/EmbeddedChat#1482 ·
Les mainteneurs répondent en général sous 1 jour
-
Bug: UIKit PreviewBlock cover image tiles repeatedly and stretches across viewport when zoomed outPeut-être pris @swarnendusahu10-dotcom l’a pris il y a 3 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
RocketChat/EmbeddedChat#1480 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de RocketChat/EmbeddedChat
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Life-Framework/Life-Framework#7017 ·
Les mainteneurs répondent en général sous 1 jour
-
e/DevOps enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
Accenture/sfmc-devtools#2795 ·
Les mainteneurs répondent en général sous 1 jour
-
agent/guide documentation help wanted stage/010-actionable
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
kubestellar/console-kb#4003 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
FilOzone/synapse-sdk#1201 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour