Topic: Hiding the Gitlab Access Token

Bridget Melvin premium asked 1 year ago

Expected behavior I am trying to hide the gitlab access token in my package json but am unclear how to accomplish this with environment variables. Unforunately, I cannot install via SSH as there are errors that are unresolvable.

Actual behavior I am struggling to access .env variables within my package.json... I have dotenv installed but not sure where to require it given I need to access the environment variables from within package.json .. How is this accomplished?

Resources (screenshots, code snippets etc.) *.env file*


** package.json scripts **

  "scripts": {
    "start": "webpack serve --config config/",
    "build": "webpack --config config/",
    "postinstall": "npm install git+https://${MDB_TOKEN}@${MDB_URL}"

Krzysztof Wilk staff commented 1 year ago


Can you try correcting the script from npm install git+https://${MDB_TOKEN}@${MDB_URL} to npm install git+https://oauth2:${MDB_TOKEN}@${MDB_URL}?

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Premium
  • Premium support: Yes
  • Technology: MDB React
  • MDB Version: MDB5 4.1.0
  • Device: Surface Laptop Studio
  • Browser: Chrome
  • OS: Windows 11
  • Provided sample code: No
  • Provided link: No