-
Notifications
You must be signed in to change notification settings - Fork 346
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(auth): Allow workspace to pre-populate URL for quick sign-in (#6653) #6812
Conversation
) VS Code side part of https://linear.app/sourcegraph/issue/SRC-908/automate-cody-authflow-vs-code After a user creates a workspace we want to make it easy for them to sign-in to the instance in their editor. For enterprise instances today, they need to copy the instance url, go into VS Code and then choose to signin with enterprise instance and then paste the url. This change will help stream-line that flow by allowing the UI in sourcegraph to link to VS Code with a url like `vscode://sourcegraph.cody-ai?instance=someinstance.sourcegraphdev.app` VS Code will handle and either switch to that account if you already are auth'd OR pop-open the signin menu directly ![image](https://github.com/user-attachments/assets/cdab4135-2dae-48d3-945c-2e70187c37f0) Note: For initial version I limited just to workspace domains. But we can generalize that to allow other instance domains. ## Test plan 1. Validate when client doesn't have instance already 2. Validate when client already has instance connected (cherry picked from commit 9719dc4)
@umpox, thanks for pointing this out (I also noticed that when CI failed with it), I found your revert PR and applied the same logic we had before for auth resolution. Tested our workspace auth flow manually so it should be ok. But I think the logic that we have doesn't work exactly like @mmanela intended originally (maybe it was like this all the time, not sure), it works as expected when a user doesn't have any connected account in extension to the newly created workspace, but in case they had authed before we should skip this auth flow and just switch account since we already have a token in VSCode secret storage. I checked, and it looks like we always force users to go through the auth flow. This isn't a big problem since in 99% of cases it would be a fresh instance (we have this login into VSCode thing as the last step of the setup flow so I doubt users will have an account to this workspace before this step), just FYI @mmanela Screen.Recording.2025-01-27.at.13.46.45.mov |
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.
Thank you for sorting this!
… for quick sign-in (#6653) (#6818) This is cherry-picking @mmanela commit from #6653 It was recently reverted here #6794 due to problems with reverting other PRs and merge conflicts. This PR contains a required change for a successful Workspace Auth flow so we should include this in the upcoming 1.64 release ## Original PR description VS Code side part of https://linear.app/sourcegraph/issue/SRC-908/automate-cody-authflow-vs-code After a user creates a workspace we want to make it easy for them to sign-in to the instance in their editor. For enterprise instances today, they need to copy the instance url, go into VS Code and then choose to signin with enterprise instance and then paste the url. This change will help stream-line that flow by allowing the UI in sourcegraph to link to VS Code with a url like `vscode://sourcegraph.cody-ai?instance=someinstance.sourcegraphdev.app` VS Code will handle and either switch to that account if you already are auth'd OR pop-open the signin menu directly ![image](https://github.com/user-attachments/assets/cdab4135-2dae-48d3-945c-2e70187c37f0) Note: For initial version I limited just to workspace domains. But we can generalize that to allow other instance domains. ## Test plan 1. Validate when client doesn't have instance already 2. Validate when client already has instance connected (cherry-picked from commit 9719dc4) <br> Backport ef65034 from #6812 Co-authored-by: Vova Kulikov <vova@sourcegraph.com>
… URL for quick sign-in (#6653) (#6817) This is cherry-picking @mmanela commit from #6653 It was recently reverted here #6794 due to problems with reverting other PRs and merge conflicts. This PR contains a required change for a successful Workspace Auth flow so we should include this in the upcoming 1.64 release ## Original PR description VS Code side part of https://linear.app/sourcegraph/issue/SRC-908/automate-cody-authflow-vs-code After a user creates a workspace we want to make it easy for them to sign-in to the instance in their editor. For enterprise instances today, they need to copy the instance url, go into VS Code and then choose to signin with enterprise instance and then paste the url. This change will help stream-line that flow by allowing the UI in sourcegraph to link to VS Code with a url like `vscode://sourcegraph.cody-ai?instance=someinstance.sourcegraphdev.app` VS Code will handle and either switch to that account if you already are auth'd OR pop-open the signin menu directly ![image](https://github.com/user-attachments/assets/cdab4135-2dae-48d3-945c-2e70187c37f0) Note: For initial version I limited just to workspace domains. But we can generalize that to allow other instance domains. ## Test plan 1. Validate when client doesn't have instance already 2. Validate when client already has instance connected (cherry-picked from commit 9719dc4) <br> Backport ef65034 from #6812 Co-authored-by: Vova Kulikov <vova@sourcegraph.com>
This is cherry-picking @mmanela commit from #6653
It was recently reverted here #6794 due to problems with reverting other PRs and merge conflicts.
This PR contains a required change for a successful Workspace Auth flow so we should include this in the upcoming 1.64 release
Original PR description
VS Code side part of
https://linear.app/sourcegraph/issue/SRC-908/automate-cody-authflow-vs-code
After a user creates a workspace we want to make it easy for them to sign-in to the instance in their editor. For enterprise instances today, they need to copy the instance url, go into VS Code and then choose to signin with enterprise instance and then paste the url.
This change will help stream-line that flow by allowing the UI in sourcegraph to link to VS Code with a url like
vscode://sourcegraph.cody-ai?instance=someinstance.sourcegraphdev.app
VS Code will handle and either switch to that account if you already are auth'd OR pop-open the signin menu directly
Note: For initial version I limited just to workspace domains. But we can generalize that to allow other instance domains.
Test plan
(cherry-picked from commit 9719dc4)