|
1 | 1 | # Managing access tokens |
2 | 2 |
|
3 | | -The `auth.accessTokens` setting in Sourcegraph's site configuration allows admins to fine-tune parameters related to access tokens. |
| 3 | +The `auth.accessTokens` setting in Sourcegraph's site configuration allows admins to fine-tune parameters related to access tokens: |
| 4 | + |
| 5 | +```json |
| 6 | +{ |
| 7 | + "auth.accessTokens": { |
| 8 | + "allow": "all-users-create", |
| 9 | + "allowNoExpiration": false, |
| 10 | + "maxTokensPerUser": 25, |
| 11 | + "expirationOptionDays": [7, 14, 30, 60, 90], |
| 12 | + "defaultExpirationDays": 90 |
| 13 | + } |
| 14 | +} |
| 15 | +``` |
4 | 16 |
|
5 | 17 | ## Access token creation |
6 | 18 |
|
7 | | -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.” |
| 19 | +The `allow` property permits or restricts the use of access tokens. It can be assigned one of three values: |
8 | 20 |
|
9 | | -- `none` Disables the creation of access tokens. |
10 | | -- `all-users-create` Allows users to create their own token. |
11 | | -- `site-admin-create` Allows site admins to create tokens for users. |
| 21 | +- `all-users-create` (default) Enables all users to create access tokens. |
| 22 | +- `site-admin-create` Restricts creation of new tokens to admin users (existing tokens will still work until revoked). |
| 23 | +- `none` Disables access tokens entirely. |
12 | 24 |
|
13 | | -`auth.accessTokens.maxTokensPerUser` - This config field determines the maximum number of active access tokens a user can have. The default maximum is 25 tokens. |
| 25 | +The `maxTokensPerUser` property determines the maximum number of active access tokens a user can have. The default maximum is 25 tokens. |
14 | 26 |
|
15 | 27 | ## Access token expiration |
16 | 28 |
|
17 | 29 | 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. |
18 | 30 |
|
19 | | -`auth.accessTokens.allowNoExpiration` - This controls whether tokens can be created with no expiration date. The default setting is false. |
| 31 | +`allowNoExpiration` - Controls whether tokens can be created with no expiration date. The default setting is false. |
20 | 32 |
|
21 | | -`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]. |
| 33 | +`expirationOptionDays` - The options users are presented with for the token expiration period. The default options are [7, 14, 30, 60, 90]. |
22 | 34 |
|
23 | | -`auth.accessTokens.defaultExpirationDays` - This sets the default duration selection when creating a new access token. The default is 90 days. |
| 35 | +`defaultExpirationDays` - The default duration selection when creating a new access token. The default is 90 days. |
0 commit comments