Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions docs/cli/explanations/env.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

## Overview

`src` requires two environment variables to be set to authenticate against your Sourcegraph instance.
`src` supports two authentication methods:

- Interactive OAuth via `src login`
- Access token authentication via `SRC_ACCESS_TOKEN`

Use OAuth for local interactive use, or set the environment variables below for non-interactive workflows such as scripts and CI.

## `SRC_ENDPOINT`

Expand All @@ -18,7 +23,7 @@ If the environment variable is not set, it'll default to "https://sourcegraph.co

## `SRC_ACCESS_TOKEN`

`src` uses an access token to authenticate as you to your Sourcegraph instance. This token needs to be in the `SRC_ACCESS_TOKEN` environment variable.
`src` can use an access token to authenticate as you to your Sourcegraph instance. Set it in the `SRC_ACCESS_TOKEN` environment variable. Note, `src` will use the `SRC_ACCESS_TOKEN` over the OAuth token if it is set in the environment.

To create an access token, please refer to "[Creating an access token](/cli/how-tos/creating-an-access-token)".

Expand Down
6 changes: 5 additions & 1 deletion docs/cli/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ For other options, please refer to [the Windows specific `src` documentation](/c

![Output from src login showing success](https://sourcegraphstatic.com/docs/images/batch_changes/src_login_success.png)

Once complete, you should have two new environment variables set: `SRC_ENDPOINT` and `SRC_ACCESS_TOKEN`.
### OAuth login

`src login` supports interactive OAuth login, so you can sign in without creating or exporting a `SRC_ACCESS_TOKEN`.

If you need non-interactive authentication, such as in CI or scripts, you can still use `SRC_ENDPOINT` and `SRC_ACCESS_TOKEN`.

## Run a code search

Expand Down