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
Industrial IoT Open Source Tools and Libraries

Demo applications, libraries and SDKs as well as useful connectivity tools which are maintained and released as open source software.

MindConnect-NodeJS - Setting up the CLI¶

The first step is to configure the CLI. For this, you will need application credentials (or deprecated service credentials) from your developer cockpit or SESSION and XSRF-TOKEN from the application you have been developing.

Important: the service credentials (which are now deprecated) could only be acquired by emailing Insights Hub Support. They are not connected to the Cloud Foundry Service Credentials from Insights Hub settings app.

Application Credentials / Service Credentials Configuration¶

First start the credentials configuration. This will start a web server on your local computer where you can enter the credentials.

# run mc service-credentials --help for full information

$ mc service-credentials
navigate to http://localhost:4994 to configure the CLI
press CTRL + C to exit

Navigate to http://localhost:4994 to configure the CLI.

The image below shows the dialog for adding new credentials (press on the + sign in the upper left corner)

CLI

You can get the application credentials from your developer or operator cockpit in Insights Hub. (if you don't have any application you can register a dummy one just for CLI)

CLI

Once configured you can press CTRL + C to stop the configuration server and start using the CLI. Remember the passkey you have created ,as you will be using it with almost all CLI commands.

Passkey as environment variable¶

If you don't want to enter your passkey all the time you can also set it up as Environment Variable `MDSP_PASSKEY'

This will save you the typing of the --passkey option most of the time. Remember that this is not as secure as typing it in. Use with care.

Bash:

export MDSP_PASSKEY="my.complex.passkey"

Windows CMD

set "MDSP_PASSKEY=my.complex.passkey"

Windows PowerShell

$Env:MDSP_PASSKEY="my.complex.passkey"

The results of the commands will be colored in magenta if you are using Application of Service Credentials.

Credentials Auth

You can also use the SESSION Cookie and XSRF-TOKEN from the application you are developing in the CLI. Just configure following environment variables.

export MDSP_HOST="mytenant-myapp.eu1.mindsphere.io"
export MDSP_SESSION="ZDcyMWVkNjMtYXXXXXXXlkYmQtODYxZDljZjIzOGI1"
export MDSP_XSRF_TOKEN="33771ee2-9650-XXXX-ab73-10f52cad12bf"

Windows CMD

set "MDSP_HOST=mytenant-myapp.eu1.mindsphere.io"
set "MDSP_SESSION=ZDcyMWVkNjMtYXXXXXXXlkYmQtODYxZDljZjIzOGI1"
set "MDSP_XSRF_TOKEN=33771ee2-9650-XXXX-ab73-10f52cad12bf"

Windows PowerShell

$Env:MDSP_HOST="mytenant-myapp.eu1.mindsphere.io";
$Env:MDSP_SESSION="ZDcyMWVkNjMtYXXXXXXXlkYmQtODYxZDljZjIzOGI1";
$Env:MDSP_XSRF_TOKEN="33771ee2-9650-XXXX-ab73-10f52cad12bf";

The results of the commands will be colored yellow if you are using SESSION / XSRF-TOKEN type of authorization.

Cookie Auth

The use of Service or Application credentials always takes precedence over Session Cookie / XSRF-TOKEN Authentication.

Authentication Helper¶

You can use the Mindsphere Auth Helper Chrome extension ( chrome web store ) to simplify the copying of the authentication cookies. The extension already provides the cookies in the proper format for the CLI so that you don't have to craft the MDSP_HOST, MDSP_SESSION and MDSP_XSRF_TOKEN variable manually.

extension