Insights Hub How can I switch my application behavior depending on subtenants?

2021-09-03T18:53:13Z
Developer Tools

Summary


Details

I am developing a MindSphere application and I want to switch the application behavior depending on subtenant of logged in user.

I don't know how I can know subtenant IDs and how to get the subtenant information of logged in user.

Solution

You can know subtenant ID from Setting application.

The subtenant ID can be checked from Settings > Subtentants > <YOUR_SUBTENANT> url.

For example,

https://<TENANT>-settings.eu1.mindsphere.io/data-views/68a4xxxxxxxxx3e3/details

In this case, 68a4xxxxxxxxx3e3 is the subtenant ID.

Subtenant information of logged in user can be retrieved from authentication header from your application.

Please refer to the pages for accessing authentication header:

Expressjs(JavaScript)

https://developer.mindsphere.io/concepts/concept-authentication.html#secure-access-to-your-application

Python

https://developer.mindsphere.io/howto/howto-selfhosted-integration.html#deploying-the-application

For testing purpose, you can decode the authentication header at

https://jwt.io/

You will see that the subtenant ID is contained in the payload.


Your application can use those information to switch behaviors for the subtenant. 

Notes

KB Article ID# PL8568040

Contents

SummaryDetails

Associated Components

Cloud Foundry Developer Tools - Other