OAuth Login Promise Hangs Indefinitely When User Closes Popup
Los mantenedores suelen responder en 1 día
@SatyamPandey-07 ya está trabajando en esto.
Desde el 29/11/2026.
- #1475 de @SatyamPandey-07 — abierto
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, react
- Área
- authentication, frontend
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- JavaScript
- Estrellas
- 171
- Forks
- 421
- Merge medio
- 3 d 6 h
- PR fusionados (30 d)
- 4
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de RocketChat/EmbeddedChat
-
Bug: username fallback in updateUserUsername never runs since the ddp-client migrationPosiblemente ocupada @MuhammadFaizan-prog la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
RocketChat/EmbeddedChat#1489 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: Low contrast on color swatch borders in Theme Lab (Layout Editor)Posiblemente ocupada @yashsarvaiya45 la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
RocketChat/EmbeddedChat#1486 ·
Los mantenedores suelen responder en 1 día
-
bug(api): _doConnect swallows connection/auth errors and marks failed sessions as authenticatedPosiblemente ocupada @ashwanisingh011 la tomó hace 1 día. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
RocketChat/EmbeddedChat#1484 ·
Los mantenedores suelen responder en 1 día
-
Bug: White screen crash (`Cannot read properties of undefined (reading 'members')`) when rendering UserMention outside MarkupInteractionContextPosiblemente ocupada @swarnendusahu10-dotcom la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
RocketChat/EmbeddedChat#1482 ·
Los mantenedores suelen responder en 1 día
-
Bug: UIKit PreviewBlock cover image tiles repeatedly and stretches across viewport when zoomed outPosiblemente ocupada @swarnendusahu10-dotcom la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
RocketChat/EmbeddedChat#1480 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de RocketChat/EmbeddedChat
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Life-Framework/Life-Framework#7017 ·
Los mantenedores suelen responder en 1 día
-
e/DevOps enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Accenture/sfmc-devtools#2795 ·
Los mantenedores suelen responder en 1 día
-
agent/guide documentation help wanted stage/010-actionable
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
kubestellar/console-kb#4003 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
FilOzone/synapse-sdk#1201 · 1 comentario ·
Los mantenedores suelen responder en 1 día