- Notifications
You must be signed in to change notification settings - Fork34
Improve consistency in client-side login/logout experience#590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
if(!value){ | ||
returnnull; | ||
} | ||
client.setSessionToken(value); | ||
try{ | ||
user=awaitclient.getAuthenticatedUser(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Should we attempt to get the authenticated user when thetoken
is a blank string (like when this first opens)?
Can you provide a reproducible for this? I am not sure what's special about some windows that they do not respond to the change 🤔 |
@EhabY Sure, I'll write down what I did. Open two VS Code windows to the same workspace (different folders in the same workspace, whilst logged in):
and
Now you should have two windows that are both. Make sure VS Code is set to restore previous windows after quitting. Then:
Does this help? |
9b0ba3e
to05160e8
CompareEhabY commentedSep 25, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Yes, thanks for the detailed reproducer! I can see the issue now: VS Code modals aren't dismissible without user action, which is by design (seemicrosoft/vscode#2732). I can adjust our flow so we don't close the window if the user signs in in the meantime (whether they click Do keep in mind that we cannot change the content of the modal once it's shown, so we either go for something less intrusive or just handle the fallback correctly. Using the status bar for messages which need to be updated / dismissed is suggested there as the recommended approach in the issue I mentioned. What do you think? |
05160e8
toc7df45f
CompareI like this idea. Updating the modal to clearly indicate that a login happens in another window, plus adding background login capability, would be a solid improvement. I think this is possible but I'll be careful to avoid any racey conditions. I think the following makes sense: Description:
Then it's a race between two conditions as you said, 1. Login event, 2. Modal interaction. In the case of a login event, if the user clicks anything ( |
53432cb
to569a462
CompareUh oh!
There was an error while loading.Please reload this page.
67af845
to4def400
CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Nice work@EhabY, the happy-path is now a pretty good user experience, thanks for implementing my proposal!
I noticed a situation where the login-into-other-windows functionality breaks.
- [Initial steps from previous repro]
- Select login in one (of two) windows
- Enter thewrong token (
asdf
), see a message like: "Failed to authenticate: You are ..." - Enter thecorrect token -> Welcome in onlyone window
- In the other window, press login -> token prompt, press cancel -> close window, etc.
It's a bit strange to me that authentication is performed immediately after you've typed in your token, not when pressing [Enter]. (What if you're typing it manually.)
I'm also not sure why this breaks the login flow, perhaps a login attempt (even if failed) is considered a resolution of the promise.
Uh oh!
There was an error while loading.Please reload this page.
EhabY commentedSep 30, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I think this is to provide feedback as soon as possible, VS Code allows this "validateInput" callback. If we want it on "Enter" only it might look a bit more awkward since we'd have to manually implement this validation.
Hmmm, I tried the reproducer and it seems to work (no breakage), we should only show the "Welcome" message (and resolve the promise) if the token is correct anyway, otherwise it's like nothing has changed. Did you do something else in the meantime? 🤔 |
4def400
to0ef2322
Compare
I kind of get it, but the current impl. is also kind of awkward when doing anything other than copy pasting. We can put that aside for now though, it's not relevant for this PR.
I can reproduce it quite reliably (even with your latest push). And it seems it's not even a requirement to enter the wrong token first. I'm not sure of the exact cause but I've managed to reproduce in various scenarios:
|
EhabY commentedSep 30, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hmmmm, to me this means it's one of two things: either we have a race where the 2nd window does not read the correctly entered configurations fast enough or that the session token has not changed (the latter is impossible if you deleted the Can I bother you one more time to test the latest push so we can rule out (1)? I sadly cannot reproduce so I'm not sure if this fixes it. Also are you using Windows/Mac/Linux? |
Thanks, I tested the new commit but there was no difference.
Glad you mentioned this because it seems to be exactly what's going on. I can reproduce the issue as long as I have the same token in my clipboard which I paste in, but if I grab a new token login works as expected. In either case the token is valid, it's just that in the bug scenario, the same token is used for all attempts. Could it be that even when deleting the |
Oooh I think I might know where this goes wrong now, we store the session in two different ways, once as a file for the CLI to use (this is the I don't want us to resort to file watchers but this should somehow be unified so there's one source of truth, I'll have a think and try to find an elegant solution 🤔 |
70a6c4c
tobbfb3d5
Compare…etting the session token
…rets to propagate authentication events between windows
2a1d50d
to12c7c98
CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Awesome work@EhabY! In use, everything is behaving as I'd expect and the UX is so much better, thank you. I flagged a couple of things but mainly for your awareness, feel free to dismiss if they are non-issues.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
223404c
to820cb1c
Compare648360a
intocoder:mainUh oh!
There was an error while loading.Please reload this page.
Fixes#498