Skip to content
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

Fix token-receiver url generation logic #7338

Merged
merged 1 commit into from
Mar 5, 2025

Conversation

pkukielka
Copy link
Contributor

@pkukielka pkukielka commented Mar 5, 2025

Changes

VSC uses two types of login redirect, either by vscode://sourcegraph.cody-ai uri if browser and os supports that, or through local http server if it does not.

Url we use to trigger redirect looks like that:

https://sourcegraph.com/users/pkukielka-zvxqk/settings/tokens/new/callback?requestFrom=CODY&tokenReceiverUrl=http%3A%2F%2F127.0.0.1%3A58543%aaaabbbbccccddddeeeeffffgggghhhhhh.auth/openidconnect/login?prompt_auth=github&pc=sams&redirect=/user/settings/tokens/new/callback?requestFrom=CODY&tokenReceiverUrl=http%3A%2F%2F127.0.0.1%3A58543%aaaabbbbccccddddeeeeffffgggghhhhhh

But should be:

https://sourcegraph.com/.auth/openidconnect/login?prompt_auth=github&pc=sams&redirect=%2Fuser%2Fsettings%2Ftokens%2Fnew%2Fcallback%3FrequestFrom%3DCODY%26tokenReceiverUrl%3Dhttp%3A%2F%2F127.0.0.1%3A63992%aaaabbbbccccddddeeeeffffgggghhhhhh

It was broken long time ago but we never noticed: #4664

Test plan

  1. Sing out from current account
  2. Close VSC
  3. Reopen VSC and sing in using GitHutb
  4. When Authorize Cody - VS Code Extension? window will show make sure it opens in newest Chrome (if that is not the case you can simply copy-paste it to Chrome window)
  5. Click Authorize
  6. Make sure you are properly signed in

Copy link
Member

@bobheadxi bobheadxi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

workaround LGTM for now, thanks!

@pkukielka pkukielka changed the title Patch token-receiver to do a less strict check of request uri Fix token-receiver url generation logic Mar 5, 2025
@pkukielka pkukielka force-pushed the pkukielka/patch-token-receiver branch from e08d4a1 to 30753a9 Compare March 5, 2025 15:15
@pkukielka pkukielka force-pushed the pkukielka/patch-token-receiver branch from 30753a9 to 060c16c Compare March 5, 2025 15:22
@pkukielka pkukielka merged commit a75f0e9 into main Mar 5, 2025
21 of 22 checks passed
@pkukielka pkukielka deleted the pkukielka/patch-token-receiver branch March 5, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants