Topic: Hiding the Gitlab Access Token

Bridget Melvin premium asked 4 months 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*

MDB_TOKEN="someSecret"
MDB_URL="git.mdbootstrap.com/mdb/react/mdb5/prd/mdb5-react-ui-kit-pro-essential"

** package.json scripts **

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

Krzysztof Wilk staff commented 4 months ago

Hi!

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.

FREE CONSULTATION

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

Status

Opened

Specification of the issue

  • User: 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