Created by: abeatrix
Closes https://github.com/sourcegraph/sourcegraph/issues/28311
This PR adds a new token creation callback page to improve the current auth flow for integration purposes, eg. VS Code Extension and JetBrain Extension.
Users rely on our access token to make API requests to Sourcegraph, and a lot of our extensions and features depend on it; however, The current auth flow to retrieve an access token is not seamless. See steps outlined in our docs.
Take VS Code for example:
A new token creation page that performs callbacks ( https://sourcegraph.com/user/settings/tokens/new/callback
) that can be shared with different integrations as long as the URL params that are being passed in via the URL (https://sourcegraph.com/user/settings/tokens/new/callback?requestFrom=$SOURCE
) is included in our predefined list. Once the source has been validated, it would redirect the user back to the source using the predefined redirect URL with the newly created token passing in as a new URL param, which then can be processed by the extension's URL handler (For the sourcegraph vs code extension, the link is vscode://sourcegraph/sourcegraph?code=$TOKEN
)
See Loom Video here: https://www.loom.com/share/8a668f4624e349ce9358325f000fe9e5
The proposed auth flow for VS Code as an example:
Token will be created automatically and asked if they want to redirect back to the app
Token imported to app automatically without copying and pasting manually
Consulting with the Security Team (slack thread)
To test this PR:
sg start
"sourcegraph.url": "https://sourcegraph.test:3443/"
client/vscode/package.json
from @sourcegraph/vscode
to sourcegraph
Check out the client app preview documentation to learn more.