bug: OAuth login promise hangs forever if user closes popup without completing login
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- javascript, typescript
- Domain
- authentication, frontend
Research direction
Start in loginWithRocketChatOAuth at the Promise constructor and the popup-close setInterval described in the issue, then check the caller in ChatInput.js around line 241. Trace the close path and verify that the caller's catch block receives the cancellation outcome and displays feedback; done means the promise no longer remains pending when the popup closes.
Written by the indexing model from the issue text.
Description
If a user opens the OAuth popup and closes it without finishing login, the promise in loginWithRocketChatOAuth never settles. No resolve, no reject.
The Promise constructor on line 45 only takes resolve. There's no reject. The only path to resolve() is inside the onMessage handler, which fires when the popup posts back an rc-oauth-callback message.
There IS code that detects when the popup closes (the setInterval on line 60). It cleans up the interval and the event listener, which is good. But then it just... stops. Nobody calls resolve() or reject(), so the promise sits there indefinitely:
const checkInterval = setInterval(() => {
if (popup.closed) {
clearInterval(checkInterval);
window.removeEventListener("message", onMessage);
// nothing here — promise hangs
}
}, 1000);
What happens in practice:
The caller in ChatInput.js (line 241) does:
try {
await RCInstance.auth.loginWithRocketChatOAuth();
} catch (e) {
console.error(e);
dispatchToastMessage({ type: 'error', message: e.message });
}
Since the promise never rejects, the catch block never runs. The user closes the popup and gets zero feedback — no error toast, no "login cancelled" message, nothing. The onJoin async function just silently stays stuck at the await forever.
Each time the user tries this (click JOIN, popup opens, close popup), another unresolved promise stacks up in memory. They're never garbage collected because the promise internals still hold references to the closure.
- Dominant language
- JavaScript
- Stars
- 165
- Forks
- 381
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RocketChat/EmbeddedChat
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 84/100
RocketChat/EmbeddedChat#1360 · 1 comment ·
-
Permissions change-detection in useFetchChatData is dead — applyPermissions re-runs on every call Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
RocketChat/EmbeddedChat#1317 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
RocketChat/EmbeddedChat#1315 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
RocketChat/EmbeddedChat#1313 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
RocketChat/EmbeddedChat#1294 ·
All issues in RocketChat/EmbeddedChat
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·