Skip to content

feat(vscode): Prompt to get an access token when authentication fails

Administrator requested to merge github/fork/steverice/get-token into main

Created by: steverice

If connecting to the sourcegraph instance returns a 401, give the user two actions to take. The first will take the user to sourcegraph to create a new token, using the token callback flow added in #35826 if available. The second will open the workbench settings to allow the user to paste in a token.

This is particularly useful when distributing a sourcegraph.url setting as part of the workspace/repository to point to a private instance. Since the URL is already set, the user does not get the first-time setup view when activating the sourcegraph extension. Instead, they will get this error dialog:

Access Token Error

Test plan

  • Ran existing unit tests with yarn test
  • Ran existing integration tests with yarn test-integration
  • Walked through the flow of installing the vscode extension in a fresh instance with no settings, with a URL and token already set, with only a URL set, against both sourcegraph.com and a private instance

Merge request reports

Loading