为了确保你的账户和包安全,我们强烈建议你撤销(删除)你不再需要或已被盗用的令牌。你可以撤销你创建的任何令牌,包括细粒度访问令牌。

¥To keep your account and packages secure, we strongly recommend revoking (deleting) tokens you no longer need or that have been compromised. You can revoke any token you have created, including granular access tokens.

在网站上撤销令牌

¥Revoking tokens on the website

  1. 在页面右上角,单击你的个人资料图片,然后单击访问令牌。

    ¥In the upper right corner of the page, click your profile picture, then click Access Tokens.

  2. 在令牌列表中查找要删除的令牌。

    ¥Find the token you want to delete in the token list.

  3. 单击令牌旁边的“×”按钮,或选择多个令牌并单击“删除所选令牌”。

    ¥Click the × button next to the token, or select multiple tokens and click Delete Selected Tokens.

  4. 出现提示时,确认删除。

    ¥Confirm the deletion when prompted.

使用 CLI 撤销令牌

¥Revoking tokens using the CLI

  1. 要查看令牌列表,请在命令行上运行:

    ¥To see a list of your tokens, on the command line, run:

    npm token list
  2. 在令牌表中,找到并复制要删除的令牌的 ID。

    ¥In the tokens table, find and copy the ID of the token you want to delete.

  3. 在命令行上,运行以下命令,将 123456 替换为要删除的令牌的 ID:

    ¥On the command line, run the following command, replacing 123456 with the ID of the token you want to delete:

    npm token delete 123456

    npm 会报告 Removed 1 token

    ¥npm will report Removed 1 token

  4. 要确认令牌已被删除,请运行:

    ¥To confirm that the token has been removed, run:

    npm token list

注意:你必须使用令牌 ID 来删除令牌,而不是令牌的截断版本。在某些情况下,成功撤销令牌之前可能会有长达一小时的延迟。

¥Note: You must use the token ID to delete a token, not the truncated version of the token. In some cases, there may be a delay of up to an hour before a token is successfully revoked.

npm v11.7 中文网 - 粤ICP备13048890号