Support for Browser-Based Auth from CLIs #46
Replies: 4 comments 17 replies
-
Thanks for opening @ThisIsMissEm! At a high level are you imagining an experience that is similar to what is done in the recently released GitHub CLI? |
Beta Was this translation helpful? Give feedback.
-
I haven't had an opportunity to read the RFC issue in detail yet. I'll try to grab some time early next week. But naively, this feels very much like the same problem that git has - you have a tool that has no special knowledge of the auth flows of the providers ( The thing that bridges that gap is the I guess my question is whether doing all this work in the CLI itself is necessary or we can just build a communications channel by which we let other people plug in whatever authentication provider they want. If so, can we reuse the existing git credential manager protocol. In many ways, it's easier to add support for an existing auth flow to a standalone open source tool than to convince all the registries to support a particular endpoint. |
Beta Was this translation helpful? Give feedback.
-
I'd like to back up a little bit, because again, I think that we're talking about technical implementations (the RFC) before we've clearly defined our goal, and how we're going to measure the success of reaching that goal (the product discussion). Looking at #7, you have identified one potential solution. This discussion exists to identify the path forward to meeting our goal. Our goal isn't to implement oauth in the npm CLI, because if we go add oauth to the npm 7 codebase then we will have met our goal but not necessarily helped very many people. I think that we can start with a really high level goal statement - we're trying to simplify authentication from a CLI to registries that aren't npmjs.com. (I think that this is uncontroversial, but I think that starting here is important to ensure that we're unified.) From there, I think that we need to define:
In other words: if our goal is to improve the lives of npm 7 customers using Verdaccio, then I think that we have a pretty clear picture of what we can do to get there. But I think that our goal should be bigger than that. If we want to improve the lives of npm 6 users of Verdaccio, or yarn 1 users of npm Enterprise, then this decision making will guide the technical implementation.
Note that this is not using git for credentials. It's an example of an external process. Git moves the authentication handling out of process. This may (not necessarily is) a model that we want to explore because:
My point isn't that we should do this. My point is that we need to decide what we want before we decide the technology that gets us there. |
Beta Was this translation helpful? Give feedback.
-
I don't think that you're being forceful or argumentative, but I do think that we have a bit of an impedance mismatch in our discussion... sometimes that's the tyranny of using text? It's slow and low-bandwidth. I'm happy to jump on a call if you want to chat higher bandwidth. And just in case I wasn't clear: this work needs to happen. Yes, the CLIs should be able to easily authenticate to alternate registries. No, Verdaccio shouldn't implement WebAuth to make that happen. But I also want to make sure that this will support (for instance) GitHub Packages and Artifactory.
I appreciate that, and I'm not trying to minimize the work that you've done or derail it. And indeed, I see a lot of excitement around this from the CLI side of things, which is great. But it's also only one side of the work that's needed; what I'm wondering is about the registry side. I don't see that reflected in the conversation on the RFC. (With the exception of Verdaccio, which is why I was using it in the examples.) When I asked about what registries needed to support this:
I don't think that our success metric should be "all of them", that's just not something that we will or should try to achieve.
Question one is easy and an obvious win for us. By adding this to the CLI, voila! 🎉 It's question two that I'm interested in - does GitHub Packages support oauth device flow? I think it might(?) but if it doesn't then that's not something that we should necessarily assume can be supported. Same with something like Azure Artifacts, which uses Azure's auth system and - again I think might(?) support device flow already - but if it doesn't then that's an even bigger hurdle for support because Azure's auth mechanisms are big and complex, and changing them is not trivial. That's why I'm asking what success looks like here. I don't think that we can assume that registry vendors will necessarily jump to support this if they don't already. I'd like to get clear what will be supported if we do this work, and what registries will adopt support here. Because if the answer is that 100% of registries support it out-of-the-box or will soon, then adding support in every CLI is clearly a win. But if the answer is that 0% will ever support it, then there's no point in doing any work in any CLI. But it's somewhere between 100% and 0%, and I'm wondering what that number is, because that's what should dictate the strategy here. For example: the on-premises version of npm Enterprise will never support this, and knowing that may change our implementation. (In the case of npm Enterprise on-premises, no, it certainly shouldn't.) But I'm also asking because this is the part that I can help with, given that I manage three registries and work closely with people who manage two others (GitHub Packages and Azure Artifacts, which is why I mentioned them earlier). I can pretty easily talk with the product managers over there to encourage them to add this support and understand if / when they're able to. |
Beta Was this translation helpful? Give feedback.
-
Over on the RFCs repository, I've had open the discussion to implement Browser-Based authentication. Unfortunately, I've not been able to take this further than a discussion at the moment, as I can't exactly spend unpaid time on open-source whilst freelancing and starting a company.
However, I would really like to push this forwards soon, as it's a constant pain source and I've lost countless hours helping people authenticate with registries other than npm's official registry (Github Packages, Verdaccio). The sooner we can get this feature past RFC (it's already been discussed a lot), built, and shipped, the sooner people will be able to use private packages with a simple, easy to use workflow.
I would love to see this feature brought on to the npm roadmap, even though it's still just a discussion over on the RFCs repo. The difference in end-user experience will be extraordinary when working on any project that required private packages.
For instance, common problems I've encountered with using:
Browser-Based Authentication means all of these issues can be address in the respective frontends for the various repositories, resulting in the user either cancelling the authentication flow (not logging in) or logging in and getting valid crendential so the next
npm install
oryarn install
works flawlessly*.Beta Was this translation helpful? Give feedback.
All reactions