feat(npm): add hook for getting the authentication header#2664
feat(npm): add hook for getting the authentication header#2664arcanis merged 1 commit intoyarnpkg:masterfrom
Conversation
f6dfc1d to
8751e67
Compare
|
@arcanis Is there something wrong with this PR? If there is I'd like to fix it |
There was a problem hiding this comment.
Hey @waterfoul! Sorry for the delay, it felt off my radar 🙁
Just two nits (and a rebase); I'd have done it myself but your PR doesn't seem open to maintainers edit (probably because of your org settings).
| declined: | ||
| - "@yarnpkg/plugin-compat" | ||
| - "@yarnpkg/plugin-npm-cli" | ||
| - "@yarnpkg/cli" |
There was a problem hiding this comment.
You need to mark @yarnpkg/cli as minor as well.
|
|
||
|
|
|
|
||
| const header = await configuration.reduceHook((hooks: Hooks) => { | ||
| return hooks.getNpmAuthenticationHeader; | ||
| }, undefined, registry, {configuration, ident}); |
There was a problem hiding this comment.
Would this be a good time to use an object instead of multiple arguments?
There was a problem hiding this comment.
I prefer to keep things uniform for now, until it gets fixed in a sweeping pass. Given that BC will have to be preserved somehow, new hooks will likely follow a slightly different format.
|
I forgot to wait for your fixes 🤦♀️ Will fix it on master, nevermind. |
What's the problem this PR addresses?
Adds a hook for adding authentication headers, intended to be used for OAuth style authentication flows.
Closes #2067
...
How did you fix it?
I used reduceHook inside getAuthenticationHeader to collect the potential values from the hook, then return the provided value if there is one instead of checking npmAuthToken or npmAuthIdent
...
Checklist