Cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot connect to MindSphere API NodeJS

Experimenter
Experimenter

Dear all experts,

I've pushed my web app to Cloud Foundry. Now I want to access my assets via Mindsphere API. 

I follow this instruction : https://developer.mindsphere.io/concepts/concept-authentication.html

My simple program in index.js

router.get('/test', function (req, res) {
  authHeader = req.get("authorization");
  request
  .get('https://gateway.eu1.mindsphere.io/api/assetmanagement/v3/assets')
  .set('Authorization', authHeader)
  .set('Accept', 'application/json')
  .then(function(data) {
      res.json({
        resources: data.body.resources
      });
  }).catch(err => {
      console.error(err.message, err.status);
      res.status(err.status).json({ message: 'Failed to fetch users.'});
  });
});

But when I enter app, it fails with error

 

MindSphereAPI.PNG

 

I don't know if I miss something. Please help me