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. managing_access_tokens

Managing access tokens

The auth.accessTokens setting in Sourcegraph's site configuration allows admins to fine-tune parameters related to access tokens.

Access token creation

The auth.accessTokens.allow configuration field permits or restricts the creation of access tokens. It can be assigned one of three values: "none," "all-users-create" (which is the default option), or "site-admin-create.”

  • none Disables the creation of access tokens.
  • all-users-create Allows users to create their own token.
  • site-admin-create Allows site admins to create tokens for users.

auth.accessTokens.maxTokensPerUser - This config field determines the maximum number of active access tokens a user can have. The default maximum is 25 tokens.

Access token expiration

Admins can set expiration policies for access tokens. After this specified period, tokens will automatically lose their access. Note that tokens created before version 5.3 do not expire; this policy only applies to new tokens.

auth.accessTokens.allowNoExpiration - This controls whether tokens can be created with no expiration date. The default setting is false.

auth.accessTokens.expirationOptionDays - This represents the options users are presented with for the token expiration period. The default options are [7, 14, 30, 60, 90].

auth.accessTokens.defaultExpirationDays - This sets the default duration selection when creating a new access token. The default is 90 days.

On this page

  1. Managing access tokens

    1. Access token creation
    1. Access token expiration

Edit this page on GitHub
Questions? Give us feedback