Creating an access token
Access tokens permit authenticated access to the Sourcegraph API. This is required for the src
command line interface to Sourcegraph to operate, and also allows other tools that integrate with Sourcegraph to issue requests on your behalf.
Creating an access token is done through your user settings. This video shows the steps, which are then described below:
-
From any Sourcegraph page, click on your avatar at the top right of the page.
-
Select Settings from the dropdown menu.
-
Select Access tokens from the sidebar menu.
-
Click Generate new token.
-
Enter a description, such as
src
. -
Click Generate token.
-
Sourcegraph will now display your access token. You must copy it from this screen: once this page is closed, you cannot access the token again, and can only revoke it and issue a new one.
You can then set the SRC_ACCESS_TOKEN
environment variable to the token to use it with src
.