Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid enabling 2FA for packages published to external registries #433

Merged
merged 3 commits into from
Jul 15, 2019

Conversation

oligot
Copy link
Contributor

@oligot oligot commented Jun 20, 2019

External registry don't all support two-factor authentication.

For example, when using Nexus as npm registry, the command

> npm profile enable-2fa

fails with

npm ERR! code E400
npm ERR! 400 Bad Request - POST http://nexus.../content/groups/npm-all/-/npm/v1/tokens

npm ERR! A complete log of this run can be found in:
npm ERR!     ...npm/_logs/2019-06-20T09_24_05_833Z-debug.log

This change disables the two-factor authentication task for external registry so that we can continue to publish packages on Nexus.

External registry don't all support two-factor authentication.

For example, when using [Nexus as npm
registry](https://blog.sonatype.com/using-nexus-3-as-your-repository-part-2-npm-packages),
the command

```bash
> npm profile enable-2fa
```

fails with

```
npm ERR! code E400
npm ERR! 400 Bad Request - POST http://nexus.../content/groups/npm-all/-/npm/v1/tokens

npm ERR! A complete log of this run can be found in:
npm ERR!     ...npm/_logs/2019-06-20T09_24_05_833Z-debug.log
```

This change disables the two-factor authentication task for external registry so that we can continue to publish packages on Nexus.
@ianwalter
Copy link
Contributor

ianwalter commented Jun 24, 2019

I wonder if any private registries support 2FA other than npm? If so, maybe it's be worth it to add some logic to check?

@itaisteinherz itaisteinherz changed the title Disable 2fa for external registry Avoid enabling 2FA for packages published to external registries Jun 28, 2019
Copy link
Collaborator

@itaisteinherz itaisteinherz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me as a temporary solution to the issue, however I'd like to see what @sindresorhus has to say about this before merging the PR.

source/index.js Outdated Show resolved Hide resolved
@sindresorhus
Copy link
Owner

Can you mention in small text under Enables two-factor authentication on new repositories in the readme that it does not apply to external registries?

@oligot
Copy link
Contributor Author

oligot commented Jul 15, 2019

Can you mention in small text under Enables two-factor authentication on new repositories in the readme that it does not apply to external registries?

done in e263ff6

Fix styling.
@itaisteinherz itaisteinherz merged commit ab35fb9 into sindresorhus:master Jul 15, 2019
@itaisteinherz
Copy link
Collaborator

Thanks @oligot!

@oligot oligot deleted the 2fa-external-registry branch July 15, 2019 11:22
@oligot
Copy link
Contributor Author

oligot commented Jul 15, 2019

🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants