Sourcegraph DocsSourcegraph Docs
  • Code Intelligence

    • Cody
    • Code Search
  • Code Management

    • Batch Changes
    • Code Monitoring
    • Code Ownership
    • Code Insights
    • Notebooks
  • Platform

    • Sourcegraph Admin
    • Sourcegraph Cloud
    • Integrations
  • CLI & API

    • Sourcegraph & Cody CLI
    • Sourcegraph GraphQL API
    • Sourcegraph Stream API
  • Help & Support

    • SLAs & Premium Support
    • How to videos
    • Tutorials
    • Sourcegraph Accounts
    • Changelog
    • Technical changelog
    • Releases
  1. Docs
  2. cli
  3. how-tos
  4. revoking_an_access_token

Revoking an access token

Access tokens are tokens starting with sgp_ which permit authenticated access to the Sourcegraph API. If you accidentally disclose an access token - such as by committing it to a source code repository - you should revoke it to prevent it from being used without your permission.

  1. From any Sourcegraph page, click on your avatar at the top right of the page.
  2. Select Settings from the dropdown menu.
  3. Select Access tokens from the sidebar menu.
  4. Identify the access token that was leaked and click the Delete button next to it.

You can then confirm that the access token was revoked by making a request to the GraphQL API:

SHELL
curl \ -H 'Authorization: token <YOUR_REVOKED_TOKEN>' \ -d '{"query":"query { currentUser { username } }"}' \ https://sourcegraph.com/.api/graphql

If the token has been revoked, you will receive a response containing "Invalid access token".

On this page

  1. Revoking an access token


Edit this page on GitHub
Questions? Give us feedback