Managing tokens

How to manage your tokens. Learn how to list, create and revoke tokens.

Accessing a Bytesafe registry requires a valid access token to use with the Bytesafe servers.

Authentication by running npm login will automatically store a personal authToken in your .npmrc file.

But teams may want to create additional and specific tokens for CI/CD systems or for sharing.

This page describes how to:

  • Create new access tokens
  • List existing tokens (created by the user)
  • Revoke tokens

Create a token

Creating a new access token for a Bytesafe registry requires a password (and prior authentication by the user).

Password is available in Registry Information in Bytesafe. Click the More info button in the top right corner of a registry page to access Registry Information:

registry-token

Users should take into consideration if they need a token that is read-only or not. CI/CD environments may only require read permissions.

Read-write token

npm --registry 'https://example.bytesafe.dev/r/default/' token create

The newly created read-write token is displayed in the terminal (run the command above and enter a valid password for the registry).

| token            | 01EPF8PPQ9WZQ5TADPCV8DPMG5       |
|------------------|----------------------------------|
| readonly         | false                            |
| cidr_whitelist   | null                             |
| created          | 2020-11-06T17:12:14Z             |

Read-only token

npm --registry 'https://example.bytesafe.dev/r/default/' token create --read-only

The newly created read-only token is displayed in the terminal (run the command above and enter a valid password for the registry).

| token            | 01EPF8RQX26R2Q2ZCY28AP1JMH       |
|------------------|----------------------------------|
| readonly         | true                            |
| cidr_whitelist   | null                             |
| created          | 2020-11-06T17:13:21Z             |

List all existing access tokens

To list all available tokens users can use either an npm client or the Bytesafe web application.

List tokens for a user from Bytesafe web application

Go to the Access tokens page by expanding the profile menu in the bottom left corner of Bytesafe.

access-tokens

List access tokens using npm

npm token list

The output only shows the last couple of characters of the actual token (the full token is only available on creation).

The response when executing the command also includes information regarding if the token is read-only or not.

Example output with both read/write tokens

| id        | token           | created         | readonly  | CIDR whitelist   |
|-----------|-----------------|-----------------|-----------|------------------|
| 2b4fc6    | KMQP71...       | 2020-11-06      | no        |                  |
| 85abee    | 8DPMG5...       | 2020-11-06      | no        |                  |
| 807d1f    | AP1JMH...       | 2020-11-06      | true      |                  |

Currently Bytesafe does not support CIDR whitelist.

Revoke a token

The tokens created are long-lived and will therefore be valid until they expire.

If you want to revoke a token use either an npm client or the Bytesafe web application

Delete access tokens using Bytesafe web application

Go to the Access tokens page by expanding the profile menu in the bottom left corner of Bytesafe.

To delete a token, click delete on the specific card.

delete-token

Revoke an access token using npm

npm token revoke <token IDs>

Example of how to remove a token.

npm token revoke 85abee

The output confirms the number of removed tokens

Removed 1 token

You can also remove multiple tokens by providing a list of comma separated token IDs

Getting access denied when trying to create or list a token?

The request is most likely not providing the access token correctly to Bytesafe. See our troubleshooting page on how to resolve authentication issues.