sherlockth47
sherlockth47

Reputation: 1

Missing some of the environment variables

I am trying to create a Viewer with AutodeskPlattformService using the code on GitHub, and when I set the "client ID", "client secret" and "bucket name" on the aps-simple-viewer-nodejs folder and run "npm start", it says "Missing some of the environment variables. When I set the "client ID", "client secret" and "bucket name" on the nodejs-simple-viewer-nodejs folder and run "npm start", I get the message "Missing some of the environment variables.

Upvotes: 0

Views: 737

Answers (3)

Gohan Freecs
Gohan Freecs

Reputation: 1

  1. First Install dotenv : npm i dotenv

  2. Then in config.js file add at the first line : require('dotenv').config()

  3. Create .env file in the root folder and add your variables : APS_CLIENT_ID=XXXXXXXXXXXXXXXXXXXXXX APS_CLIENT_SECRET=XXXXXXXXXXXXX

Upvotes: 0

Deepali Srivastava
Deepali Srivastava

Reputation: 71

  1. First add launch.json file in .vscode folder
{
 "version": "0.2.0",
  "configurations": [
    {
      "type": "pwa-node",
      "request": "launch",
      "name": "Launch Program",
      "skipFiles": ["<node_internals>/**"],
      "program": "${workspaceFolder}\\start.js",
      "envFile": "${workspaceFolder}/.env"
    }
  ]
}
  1. Create .env file in root folder
  2. Enter this in .env file
APS_CLIENT_ID= your client id
APS_CLIENT_SECRET= your client secret
 APS_CALLBACK_URL= http://localhost:3000/api/forge/callback/oauth

Similar like this

Upvotes: 0

Deepali Srivastava
Deepali Srivastava

Reputation: 71

make a launch.json file under .vscode folder

{
    "version": "0.2.0",   "configurations": [
    {
      "type": "pwa-node",
      "request": "launch",
      "name": "Launch Program",
      "skipFiles": ["<node_internals>/**"],
      "program": "${workspaceFolder}\\start.js",
      "env": {
        "APS_CLIENT_ID": "",
        "APS_CLIENT_SECRET": "",
        //   "GoogleAPIkey": "",
        "APS_CALLBACK_URL": "http://localhost:3000/api/forge/callback/oauth"
        /* "redirect_uri": "http://localhost:3000/api/forge/callback/oauth"     */
      }
    }   ] }

Upvotes: 0

Related Questions