The chat responses are generated using Generative AI technology for intuitive search and may not be entirely accurate. They are not intended as professional advice. For full details, including our use rights, privacy practices and potential export control restrictions, please refer to our Generative AI Service Terms of Use and Generative AI Service Privacy Information. As this is a test version, please let us know if something irritating comes up. Like you get recommended a chocolate fudge ice cream instead of an energy managing application. If that occurs, please use the feedback button in our contact form!
Skip to content
Insights Hub and Industrial IoT

Insights Hub drives smart manufacturing through the industrial Internet of Things. Gain actionable insights with asset and operational data and improve your processes.

Insights Hub Credentials¶

Introduction¶

The Insights Hub Credentials contain details for fetching new tokens and store fetched tokens.

Hint

Placeholders in the following samples are indicated by angle brackets < >.

Creating MindsphereCredentials Objects¶

Object Name: MindsphereCredentials

Creating MindsphereCredentials using a User Token¶

Applications can pass a user token which is obtained from the request header to clients using UserCredentials object as below:

// Require the class UserCredentials available in mindsphere-sdk-node-core module
const UserCredentials = require('mindsphere-sdk-node-core').UserCredentials;

// Construct the UserCredentials object
let user_credentials = new UserCredentials({'authorization': '<user_token>'});

Creating MindsphereCredentials using App Specific Service Credentials¶

The app specific service credentials must be provided programmatically or via environment variables. App specific service credentials are obtained from Developer Cockpit or Operator Cockpit.

// Require the class AppCredentials available in `mindsphere-sdk-node-core` module
const AppCredentials = require('mindsphere-sdk-node-core').AppCredentials;

// Construct the AppCredentials object
let app_credentials = new AppCredentials({
         keyStoreClientId: '<client_id>',
         keyStoreClientSecret: '<client_secret>',
         appName: '<app-name>',
         appVersion: '<app_version>',
         hostTenant: '<host_tenant>',
         userTenant: '<user_tenant>'
});

Creating MindsphereCredentials using Tenant Specific Service Credentials¶

The tenant specific service credentials must be provided programmatically or via environment variables. Tenant specific service credentials are obtained as described in Accessing MindSphere APIs with Service Credentials. If credentials are set via environment variables, the TenantCredentials object does not need to be build.

// Require the class TenantCredentials available in mindsphere-sdk-node-core module
const TenantCredentials = require('mindsphere-sdk-node-core').TenantCredentials;

// Construct the TenantCredentials object
let tenant_credentials = new TenantCredentials({
         clientId: '<client_id>',
         clientSecret: '<client_secret>',
         tenant:'<tenant_id>'
});

Creating MindsphereCredentials using Tenant specific Service Credentials for Subtenant Impersonation¶

The tenant specific service credentials for subtenant impersonation must be provided programmatically or via environment variables. If credentials are set via environment variables, the TenantCredentials object does not need to be build.

// Require the class TenantCredentials available in mindsphere-sdk-node-core module
const TenantCredentials = require('mindsphere-sdk-node-core').TenantCredentials;

// Construct the TenantCredentials object
let tenant_credentials = new TenantCredentials({
         clientId: '<client_id>',
         clientSecret: '<client_secret>',
         tenant:'<tenant_id>',
         subTenant:'<subtenant_id>'
});