Skip to content

Commit 25ffc7a

Browse files
jpg619dhei
andauthored
[update]: legacy access token creation workflow from access tokens documentation (#1756)
### Summary: Added notes on deprecated legacy access token references and removed few documentation due to deprecation ### File Changes (3 files) 1. `content/integrations/integrating-npm-with-external-services/creating-and-viewing-access-tokens.mdx` 2. `content/integrations/integrating-npm-with-external-services/about-access-tokens.mdx` 3. `content/integrations/integrating-npm-with-external-services/using-private-packages-in-a-ci-cd-workflow.mdx` ### Changes Made - Added `note` for legacy token creation workflow from access tokens documentation --------- Co-authored-by: Di Hei <[email protected]>
1 parent d75e8c8 commit 25ffc7a

File tree

3 files changed

+17
-66
lines changed

3 files changed

+17
-66
lines changed

content/integrations/integrating-npm-with-external-services/about-access-tokens.mdx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ redirect_from:
1313

1414
An access token is an alternative to using your username and password for authenticating to npm when using the API or the npm command-line interface (CLI). An access token is a hexadecimal string that you can use to authenticate, and which gives you the right to install and/or publish your modules.
1515

16-
There are two types of access tokens available:
17-
18-
- [Legacy tokens](#about-legacy-tokens)
19-
- [Granular access tokens](#about-granular-access-tokens)
16+
As of November 2025, access tokens can only be [Granular access tokens](#about-granular-access-tokens). Legacy access tokens are removed.
2017

2118
You can create access tokens to give other tools (such as continuous integration testing environments) access to your npm packages. For example, GitHub Actions provides the ability to store [secrets](https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets), such as access tokens, that you can then use to authenticate. When your workflow runs, it will be able to complete npm tasks as you, including installing private packages you can access.
2219

@@ -25,13 +22,19 @@ You can work with tokens from the web or the CLI, whichever is easiest. What you
2522
npm token commands let you:
2623

2724
- View tokens for easier tracking and management
28-
- Create new legacy tokens
25+
- Create new legacy tokens (deprecated)
2926
- Limit access according to IP address ranges (CIDR)
3027
- Delete/revoke tokens
3128

3229
For more information on creating and viewing access tokens on the web and CLI, see "[Creating and viewing access tokens][create-token]".
3330

34-
## About legacy tokens
31+
## About legacy tokens (Deprecated)
32+
33+
<Note variant="danger">
34+
35+
**Warning:** Legacy access tokens are removed as of November 2025.
36+
37+
</Note>
3538

3639
Legacy tokens are created with the same permissions as the user who created them. The npm CLI automatically generates and uses a publish token when you run `npm login`.
3740

content/integrations/integrating-npm-with-external-services/creating-and-viewing-access-tokens.mdx

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,6 @@ You can [create](#creating-access-tokens) and [view](#viewing-access-tokens) acc
88

99
## Creating access tokens
1010

11-
### Creating legacy tokens on the website
12-
13-
<Note>
14-
15-
**Note:** For greater security, we recommend using [granular access tokens](#creating-granular-access-tokens-on-the-website) instead of legacy read-only tokens or legacy automation tokens. For CI/CD workflows, consider using [trusted publishing](/trusted-publishers), which eliminates the need for long-lived tokens entirely.
16-
17-
</Note>
18-
19-
1. In the upper right corner of the page, click your profile picture, then click **Access Tokens**.
20-
21-
<Screenshot src="/integrations/integrating-npm-with-external-services/tokens-profile.png" alt="Screenshot of the account menu with the tokens link selected" />
22-
23-
2. Click **Generate New Token**, then select **legacy token** from the dropdown menu.
24-
25-
<Screenshot src="/integrations/integrating-npm-with-external-services/create-token.png" alt="Screenshot of the create new token button" />
26-
27-
3. (Optional) Name your token.
28-
29-
4. Select the type of access token:
30-
- **Read-only**: A read-only token can only be used to download packages from the registry. It will have permission to read any private package that you have access to. This is recommended for automation and workflows where you are installing packages, but not publishing new ones.
31-
32-
- **Automation**: An automation token can download packages and publish new ones, but if you have two-factor authentication (2FA) configured on your account, it will **not** be enforced. You can use an automation token in continuous integration workflows and other automation systems to publish a package even when you cannot enter a one-time passcode. For enhanced security in CI/CD workflows, consider using [trusted publishing](/trusted-publishers) instead, which eliminates the need for long-lived tokens.
33-
34-
- **Publish**: A publish token can perform any action on your behalf, including downloading packages, publishing packages, and changing user settings or package settings. If you have two-factor authentication configured on your account, you will be required to enter a one-time passcode when using a publish token. This is recommended for interactive workflows such as a CLI.
35-
36-
<Screenshot src="/integrations/integrating-npm-with-external-services/token-level-select.png" alt="Screenshot of the access level selection" />
37-
38-
5. Click **Generate Token**.
39-
40-
6. Copy the token from the top of page.
41-
4211
### Creating granular access tokens on the website
4312

4413
1. In the upper right corner of the page, click your profile picture, then click **Access Tokens**.
@@ -83,38 +52,12 @@ You can [create](#creating-access-tokens) and [view](#viewing-access-tokens) acc
8352

8453
### Creating tokens with the CLI
8554

86-
You can create tokens with **read-only** permissions or **read and publish** permissions with the CLI.
87-
8855
<Note>
8956

90-
**Note:** You cannot create legacy automation tokens or granular access tokens from the CLI. You must use the website to generate these types of tokens. For more information, see "[Creating legacy tokens on the website](#creating-legacy-tokens-on-the-website)" and "[Creating granular access tokens on the website](#creating-granular-access-tokens-on-the-website)."
57+
**Note:** You cannot create granular access tokens from the CLI. You must use the website to generate these types of tokens. For more information, see "[Creating granular access tokens on the website](#creating-granular-access-tokens-on-the-website)."
9158

9259
</Note>
9360

94-
- **Read-only:** Tokens that allow installation and distribution only, but no publishing or other rights associated with your account.
95-
- **Publish:** The default setting for new tokens, and most permissive token type. Publish tokens allow installation, distribution, modification, publishing, and all rights that you have on your account.
96-
97-
In addition, you can specify that the token is only valid for a specific IPv4 address range, using [CIDR][cidr-wiki] notation. The token will only be valid when used from the specified IP addresses.
98-
99-
1. To create a new token, on the command line, run:
100-
- `npm token create` for a read and publish token
101-
- `npm token create --read-only` for a read-only token
102-
- `npm token create --cidr=[list]` for a CIDR-restricted read and publish token. For example, `npm token create --cidr=192.0.2.0/24`
103-
- `npm token create --read-only --cidr=[list]` for a CIDR-restricted read-only token
104-
2. When prompted, enter your password.
105-
3. If you have enabled [two-factor authentication][tfa], when prompted, enter a one-time password.
106-
4. Copy the token from the **token** field in the command output.
107-
108-
#### CIDR-restricted token errors
109-
110-
If the CIDR string you enter is invalid or in an inappropriate format, you will get an error similar to the one below:
111-
112-
```
113-
npm ERR! CIDR whitelist contains invalid CIDR entry: X.X.X.X./YY,Z.Z.. . .
114-
```
115-
116-
Make sure you are using a valid IPv4 range and try creating the token again.
117-
11861
## Viewing access tokens
11962

12063
<Note>
@@ -141,8 +84,7 @@ npm token list
14184

14285
- **id:** Use the token ID to refer to the token in commands.
14386
- **token:** The first digits of the actual token.
144-
- **create:** Date the token was created.
145-
- **readonly:** If yes, indicates a read-only token. If no, indicates a token with both read and publish permissions.
87+
- **created:** Date the token was created.
14688
- **CIDR whitelist:** Restricts token use by IP address.
14789

14890
[tfa]: about-two-factor-authentication

content/integrations/integrating-npm-with-external-services/using-private-packages-in-a-ci-cd-workflow.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ When generating an access token for use in a continuous integration environment,
2727

2828
If you use a legacy token instead, by default, `npm token create` will generate a token with both read and write permissions. We recommend creating a read-only token:
2929

30+
<Note variant="danger">
31+
32+
**Warning:** Legacy access tokens are removed as of November 2025.
33+
34+
</Note>
35+
3036
```
3137
npm token create --read-only
3238
```

0 commit comments

Comments
 (0)