- Click the login button. You get redirected to GitHub and prompted to authorize the registry to access your public information.
- If the registry requires private org membership, click the Request
or Grant button next to the org to get
read:org
access to the registry. - Authorize the registry to access your GitHub user and org info. You only need to do this once.
- Once completed, you'll be redirected back to Verdaccio.
- You are now logged in 🎉.
The easiest way to configure npm is to use this short command:
npx verdaccio-github-oauth-ui --registry http://localhost:4873
On success you should see this page in your browser:
- Verdaccio 5:
Open the "Configuration" dialog and click "Copy to clipboard":
- Run the copied commands on your terminal:
npm config set //localhost:4873/:_authToken "SECRET_TOKEN"
- Verify npm is set up correctly by running the
whoami
command:
npm whoami --registry http://localhost:4873
If you see your GitHub username, you are ready to start installing and publishing packages.
Click the Logout button as per usual.
Verdaccio has two authorization methods. Depending on your chosen method, you will need to revoke the token in a different way.
You can read more about this in the Verdaccio docs:
You can find a more detailed breakdown of tokent types and token revocation in #176.
API/CLI tokens are valid for the duration you configured in the verdaccio config
at security.api.jwt.sign.expiresIn
. UI tokens are valid for the duration you
configured in the verdaccio config at security.web.sign.expiresIn
. After this
period, tokens are automatically invalid.
You can revoke all tokens for all users by changing the Verdaccio secret
in storage/.verdaccio-db.json
.
You can revoke the token by revoking it in the GitHub settings.
- Go to https://github.com/settings/applications
- Find the OAuth app for your registry
- Click the Revoke button from the ... menu as shown below
- Go to https://github.com/settings/applications, or, if owned by an org, https://github.com/organizations/ORG_NAME/settings/applications
- Find the OAuth app for your registry
- Open the OAuth app settings
- On the settings page click the Revoke all user tokens button
GitHub memberships are determined using the auth.github-oauth-ui.token
that
you configured in the verdaccio config.
This token can be revoked at https://github.com/settings/tokens where you created it.