NPM Proxy against registry.npmjs.org with private registries auth (how?)

983 views
Skip to first unread message

gTazkirah

unread,
May 18, 2018, 4:37:56 AM5/18/18
to Nexus Users
Hi all,

i've been following this article using docker nexus 3, to have a cache layer for my CI Servers when my projetcs download dependencies. And everything works perfect less the private artifacts.

I have an npmjs.org account where i publish artifacts, and when in configure  the npm proxy repository i don't know how i can specify the auth so when npm install goes to the proxy registry and ask for a private dependency, it can be downloaded as normal.


Cheers,

Joseph Stephens

unread,
May 18, 2018, 10:18:36 AM5/18/18
to gTazkirah, Nexus Users
Hi Paulino,

In the repository configuration there is a section for HTTP credentials


does that help you?

Thanks,

Joe

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/71c00b83-bb6b-419c-b396-e21fd5312c4c%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.



--
Joseph Stephens

Paulino Padial

unread,
May 21, 2018, 5:25:57 AM5/21/18
to Nexus Users, paulino...@gig.com
Hi Joe,

yes, i tried, but i always get a 404 not found.
If i configure my npmrc directly againsts npmjs with my authToken it works.


On Friday, May 18, 2018 at 4:18:36 PM UTC+2, Joseph Stephens wrote:
Hi Paulino,

In the repository configuration there is a section for HTTP credentials


does that help you?

Thanks,

Joe
On Fri, May 18, 2018 at 5:37 AM, 'gTazkirah' via Nexus Users <nexus...@glists.sonatype.com> wrote:
Hi all,

i've been following this article using docker nexus 3, to have a cache layer for my CI Servers when my projetcs download dependencies. And everything works perfect less the private artifacts.

I have an npmjs.org account where i publish artifacts, and when in configure  the npm proxy repository i don't know how i can specify the auth so when npm install goes to the proxy registry and ask for a private dependency, it can be downloaded as normal.


Cheers,

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.



--
Joseph Stephens

Mark Dodgson

unread,
May 21, 2018, 6:15:26 AM5/21/18
to Paulino Padial, Nexus Users
Hi Paulino,

Did you add the npm Bearer Token Realm as shown in the image below?

Screen Shot 2018-05-21 at 11.12.46.png

Thanks

Mark


Paulino Padial

unread,
May 21, 2018, 6:46:24 AM5/21/18
to Mark Dodgson, Nexus Users
Hi Mark,

yes, this is my current config: 

To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.

Mark Dodgson

unread,
May 21, 2018, 6:51:15 AM5/21/18
to Paulino Padial, Nexus Users
Hi Paulino,

Joseph is correct, I failed to realise it is only proxy you are setting up.

Are you able to send a screenshot of your proxy configuration just to be sure your endpoints are correct?

Thanks,

Mark

Paulino Padial

unread,
May 21, 2018, 6:53:49 AM5/21/18
to Mark Dodgson, Nexus Users
Hi Mark,

sure, this is the config i use:

i tried also using the HTTP Username & Password setup that Joseph suggested but same result.

Thanks



To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.

Mark Dodgson

unread,
May 21, 2018, 7:05:10 AM5/21/18
to Paulino Padial, Nexus Users
Hi Paulino,

Do you have something like the following in your .npmrc file?

registry = http://<ip-address>:<port>/repository/npm-registry/

Thanks,

Mark

Paulino Padial

unread,
May 21, 2018, 9:58:37 AM5/21/18
to Mark Dodgson, Nexus Users
Hi Mark,

yes, i have this configured:

//myip/repository/npm-group/:_authToken=NpmToken.TokenNumber


To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.

Rich Seddon

unread,
May 21, 2018, 11:55:07 AM5/21/18
to Nexus Users, mdod...@sonatype.com
Nexus Repo 3 does not currently have support for bearer token authentication to remote repositories:


I suspect that is the problem here.

Paulino Padial

unread,
May 21, 2018, 12:40:03 PM5/21/18
to Rich Seddon, Nexus Users, Mark Dodgson
Hi Rich,

Yep, that could be the issue,

i was trying to configure two registries auth in my npmrc like:

//mynexusserver/repository/npm-group/:_authToken=NpmToken
@myscope:registry=https://registry.npmjs.org/

Trying to achieve that, normal packages goes to nexus and for scoped packages of my npm user, goes to npmjs... but it's not working.

There's any way to configure one general scope and one scope with auth in npmrc ?

BTW, in your link, someone offers a solution using an apache/nginx intermediate proxy which adds the bearer token, that also could works (i hope)

Reply all
Reply to author
Forward
0 new messages