Search Unity

Scoped registries with npm authentication

Discussion in 'Package Manager' started by Deleted User, Dec 12, 2019.

  1. Deleted User

    Deleted User

    Guest

    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

    Code (JavaScript):
    1. {
    2. "scopedRegistries": [
    3.     {
    4.       "name": "Main",
    5.       "url" : "https://{SERVERADDRESS}/artifactory/api/npm/{REPO-NAME}/",
    6.       "scopes": [
    7.         "com.company.test"
    8.       ]
    9.     }
    10.   ],
    11.   "dependencies": {
    12.     "com.unity.collab-proxy": "1.2.16",
    13.     "com.unity.ide.rider": "1.1.0",
    14.     "com.unity.ide.vscode": "1.1.3",
    15.     "com.unity.test-framework": "1.1.3",
    16.     "com.unity.textmeshpro": "2.0.1",
    17.     "com.unity.timeline": "1.2.6",
    18.     "com.unity.ugui": "1.0.0",
    19.     "com.unity.modules.ai": "1.0.0",
    20.     "com.unity.modules.androidjni": "1.0.0",
    21.     "com.unity.modules.animation": "1.0.0",
    22.     "com.unity.modules.assetbundle": "1.0.0",
    23.     "com.unity.modules.audio": "1.0.0",
    24.     "com.unity.modules.cloth": "1.0.0",
    25.     "com.unity.modules.director": "1.0.0",
    26.     "com.unity.modules.imageconversion": "1.0.0",
    27.     "com.unity.modules.imgui": "1.0.0",
    28.     "com.unity.modules.jsonserialize": "1.0.0",
    29.     "com.unity.modules.particlesystem": "1.0.0",
    30.     "com.unity.modules.physics": "1.0.0",
    31.     "com.unity.modules.physics2d": "1.0.0",
    32.     "com.unity.modules.screencapture": "1.0.0",
    33.     "com.unity.modules.terrain": "1.0.0",
    34.     "com.unity.modules.terrainphysics": "1.0.0",
    35.     "com.unity.modules.tilemap": "1.0.0",
    36.     "com.unity.modules.ui": "1.0.0",
    37.     "com.unity.modules.uielements": "1.0.0",
    38.     "com.unity.modules.umbra": "1.0.0",
    39.     "com.unity.modules.unityanalytics": "1.0.0",
    40.     "com.unity.modules.unitywebrequest": "1.0.0",
    41.     "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    42.     "com.unity.modules.unitywebrequestaudio": "1.0.0",
    43.     "com.unity.modules.unitywebrequesttexture": "1.0.0",
    44.     "com.unity.modules.unitywebrequestwww": "1.0.0",
    45.     "com.unity.modules.vehicles": "1.0.0",
    46.     "com.unity.modules.video": "1.0.0",
    47.     "com.unity.modules.vr": "1.0.0",
    48.     "com.unity.modules.wind": "1.0.0",
    49.     "com.unity.modules.xr": "1.0.0",
    50.     "com.company.test": "0.1.0"
    51.   }
    52. }
     
    Last edited by a moderator: Dec 12, 2019
  2. ethan_jl_unity

    ethan_jl_unity

    Unity Technologies

    Joined:
    Sep 27, 2018
    Posts:
    104
    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
     
    Last edited: Dec 18, 2019
    Favo-Yang likes this.
  3. AdminOh

    AdminOh

    Joined:
    Feb 11, 2016
    Posts:
    23
    A backport to the 2019.3 / 2019.4 LTS would be greatly appreciated!
     
  4. andysaia

    andysaia

    Joined:
    Nov 2, 2015
    Posts:
    21
    Any information when this will be available in a preview, beta or alpha release?
     
  5. Kaz-Luska

    Kaz-Luska

    Joined:
    Jul 8, 2019
    Posts:
    2
    :+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.
     
  6. Yacuzo

    Yacuzo

    Joined:
    Sep 22, 2016
    Posts:
    27
    +1 to 2019.3 backporting. This is the only thing holding us back for a proper devops of our numerous in-house packages.
     
  7. Mathijs_Bakker

    Mathijs_Bakker

    Joined:
    Apr 28, 2014
    Posts:
    25
    +1 for 2019.4 LTS backporting.
     
  8. avilleret

    avilleret

    Joined:
    Oct 21, 2019
    Posts:
    5
    Last edited: May 4, 2020
  9. manu73

    manu73

    Unity Technologies

    Joined:
    Aug 22, 2014
    Posts:
    68