yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.4k stars 2.72k forks source link

auth credentials are not sent in the same fashion as npm #3077

Open cdaringe opened 7 years ago

cdaringe commented 7 years ago

feature or bug

bug! 🐛

actual behavior

yarn yields a 401, where npm installs all deps successfully. :/

// $ yarn
verbose 6.173 Error: http://artifactory.<some-domain>/npm/npm-external/rxjs/-/rxjs-5.3.0.tgz: Request failed "401 Unauthorized"
// $ npm install
# nada! success!

reproduce

oh man, I would love to xref a project to reproduce, but arg, closed source project 🤕. it's also somewhat of a system level thing (e.g. yarn + registry).

here's what I have:

// .npmrc
always-auth=true
_auth="SOME_AUTH_KEY"
ca[] = "-----BEGIN CERTIFICATE-----\n...CERT_1...\n-----END CERTIFICATE-----\n"
ca[] = "-----BEGIN CERTIFICATE-----\n...CERT_2...\n-----END CERTIFICATE-----\n"
email=SOME_EMAIL
registry = https://artifactory.<some-domain>/npm/npm-external

these settings work w/ npm, but not yarn.

What is the expected behavior?

the above auth settings to work as they do w/ npm.

Please mention your node.js, yarn and operating system version.

i raise you one more and share my yarn-error.log.

does the tarball fetcher request not include the same headers/body that other xhrs do?

Daniel15 commented 7 years ago

Are you able to use a debugging proxy (such as Fiddler or Charles) to see what Yarn is doing differently to npm? That might give some hints as to what is going wrong.

cdaringe commented 7 years ago

hmm. i just booted up Charles. i see http traffic in and out, but not my https npm traffic. have any xrefs to get going a little quicker? my guess and check method here isn't proving terribly fruitful

Daniel15 commented 7 years ago

You'll need to enable SSL proxying (https://www.charlesproxy.com/documentation/proxying/ssl-proxying/) and either install Charles' root CA or set an environment variable NODE_TLS_REJECT_UNAUTHORIZED=0 to get Node.js to trust the SSL proxy.

cdaringe commented 7 years ago

hey @Daniel15, thanks for the tips. Can you advise even further, perhaps?

i have only one connected NIC, my wifi, and it shows that charles has its attention (see screenshots below).

what else could i be missing?

ssl proxy enabled:

screen shot 2017-04-09 at 6 21 40 pm

trusted cert:

screen shot 2017-04-09 at 6 27 21 pm

network proxy settings:

screen shot 2017-04-09 at 6 32 18 pm
trevorriles commented 6 years ago

@cdaringe did you ever get this worked out?

cdaringe commented 6 years ago

@trevorriles, i didn't :(

trevorriles commented 6 years ago

@trevorriles, i didn't :(

Bummer we just hit the same thing. I'll let you know if I figure anything out.