Scoped registries with npm authentication

Hello colleagues,

we have a private npm repository in artifactory and published a package to it. It is working fine with console commands to get the package. Now we are trying to use scoped registries to get it in Unity project from there. We set our package as a dependency in the manifest.json and added the scopedRegistries. I added the manifest.json at the end.

We are using the Unity 2019.3.0f1.
But the following error message occurs, pointing to an authentication problem:
An error occurred while resolving packages:
One or more packages could not be added to the local file system:
com.company.test: Request [GET https://{SERVERADDRESS}/artifactory/api/npm/{REPO-NAME}/com.company.test/-/com.company.test-0.1.0.tgz] failed with status code [401]

I tried to change the url in the manifest to “http:\{USER}:{PASSWORD}@{SERVERADDRESS}/artifactory/api/npm/{REPO-NAME}/”, but this results in the same error.

Is it possible to use an npm repository with authentication? If it is, can you point me to instruction on how to do it.

Thank you and best regards,
Meik

{
"scopedRegistries": [
    {
      "name": "Main",
      "url" : "https://{SERVERADDRESS}/artifactory/api/npm/{REPO-NAME}/",
      "scopes": [
        "com.company.test"
      ]
    }
  ],
  "dependencies": {
    "com.unity.collab-proxy": "1.2.16",
    "com.unity.ide.rider": "1.1.0",
    "com.unity.ide.vscode": "1.1.3",
    "com.unity.test-framework": "1.1.3",
    "com.unity.textmeshpro": "2.0.1",
    "com.unity.timeline": "1.2.6",
    "com.unity.ugui": "1.0.0",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0",
    "com.company.test": "0.1.0"
  }
}

Hi there,

Npm registry authentication support will be included in Unity 2020.1. This feature is not available in earlier versions but we might be back-porting this to 2019.3.

Best,
Ethan

1 Like

A backport to the 2019.3 / 2019.4 LTS would be greatly appreciated!

Any information when this will be available in a preview, beta or alpha release?

:+1: to any information about this being available to test out.
We are looking into setting up our private package manager repo but we need authentication.
We would love to be able to test it out as soon as it is available in final or preview form.

+1 to 2019.3 backporting. This is the only thing holding us back for a proper devops of our numerous in-house packages.

+1 for 2019.4 LTS backporting.

Hi,

any news on npm authentication support in Unity 2020.1?
I can’t find anything on the online documentation, but I may have missed it…
If anyone could point me to some ref that would be useful.

EDIT : I finally found this thanks to google : Npm registry authentication

Thanks

Antoine

@avilleret

NPM authentication is supported in 2019.3.4f1 and 2020.1.0a25.

You can refer to Npm registry authentication

Regards,
Manuh73