Insights Hub How can I identify the user that is logged into my custom MindApp?

2020-06-11T13:42:02Z
APIs & Services

Summary


Details

I have a custom application and would like to display in the application the user that is currently logged in. How can I get that user information?

Solution

Once you interact with a MindSphere App and information from the Backend (running in CF) is requested, the user access token is attached to the returned information. This token can be used to obtain the data on the current user.

 

For information regarding how to extract the token from the request headers (see https://developer.mindsphere.io/concepts/concept-authentication.html#calling-apis-from-backend). Contained in the decoded token you can find the email address of the logged in user ("email": "emailaddress@emailexample.com") .

 

Note: The user id that is contained in the decoded token is not equal to the user id of the relevant user in your MindSphere Tenant. However, you can request all users from the tenant using the Identity Management Service (see https://developer.mindsphere.io/apis/core-identitymanagement/api-identitymanagement-overview.html) and write your own algorithm to obtain more user information. Once you have this current user information you can display in your application however you would prefer. 

Notes

KB Article ID# PL8017251

Contents

SummaryDetails

Associated Components

APIs & Services - Other