Authentication Token

The authentication token utility is used to retrieve an Authentication Token. An Authentication Token can be used to securely communicate with a service. It's a JWT token that contains the fields listed below.

An integration for the service must be defined in the Frontend Tokens section in EMS Admin. Calling the getter function with the name of the integration will return a promise that will be resolved with an Authentication Token.

The utility contains two methods, one for usage in suite (getAuthenticationToken), one for EMSAdmin (getEMSAdminAuthenticationToken).

This utility works in iframes as well, but the UI Kit must be present on top window otherwise the promise won't resolve. The promise will be rejected if top window's domain is not whitelisted in Suite configuration.

Utility Reference

window.e.utils.getAuthenticationToken(integrationName)

window.e.utils.getAuthenticationToken('myIntegration').then(token => {
  return getDataFromBackend(token);
});

Parameters

Name Type Description
integrationName The name of the integration to get the Authentication Token for

Return value

Type Description
A promise that resolves to the Authentication token

The JWT decoded Authentication Token contains the following fields:

Name Type Description
adminId The adminId of the currently logged in admin
auditContext Contains further information about the session
customerId The customerId of the currently logged in customer
environment The name (domain) of the current environment
exp Expiration time (JWT token)
iss Token issuer (JWT token)
language Preferred language of the currently logged in admin
msid Master session ID
sapGlobalUserId SAP Global User ID

window.e.utils.getEMSAdminAuthenticationToken(integrationName)

window.e.utils.getEMSAdminAuthenticationToken('myIntegration').then(token => {
  return getDataFromBackend(token);
});

Parameters

Name Type Description
integrationName The name of the integration to get the EMS Authentication Token for

Return value

Type Description
A promise that resolves to the EMS Authentication token

The JWT decoded EMS Authentication Token contains the following fields:

Name Type Description
customerId The customerId of the currently selected customer (if any)
environment The name (domain) of the current environment
exp Expiration time (JWT token)
isAdmin Is the currently logged in staff member an admin
iss Token issuer (JWT token)
staffId The id of the current staff member logged in to EMSAdmin