Skip to main content

Authentication

getAuthenticationToken(integrationName)

Retrieves a JWT Authentication Token for securely communicating with a service. An integration must first be defined in the Frontend Tokens section in EMS Admin.

Works in iframes, but the UI Kit must be present on the top window. The promise will be rejected if the top window's domain is not whitelisted in Suite configuration.

Usage: window.e.utils.v2.auth.getAuthenticationToken(integrationName)

Parameters

NameTypeRequiredDescription
integrationNamestringyesThe name of the integration

Returns: Promise — resolves to the Authentication Token string.

JWT Fields (Engagement Cloud)

FieldTypeDescription
adminIdnumberadminId of logged-in admin
customerIdnumbercustomerId of logged-in customer
environmentstringName (domain) of current environment
languagestringPreferred language of logged-in admin
msidstringMaster session ID
sapGlobalUserIdstringSAP Global User ID
expnumberExpiration time (JWT)
issstringToken issuer (JWT)
auditContextobjectFurther session info

JWT Fields (EMSAdmin)

FieldTypeDescription
customerIdnumbercustomerId of currently selected customer
environmentstringName (domain) of current environment
isAdminbooleanIs the logged-in staff member an admin
staffIdnumberId of current staff member
expnumberExpiration time (JWT)
issstringToken issuer (JWT)

Example

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

reauthenticate()

Initiates a reauthentication flow before a sensitive operation. A Feedback Notification is displayed on failed attempts.

The reauthenticated state must be validated server-side. See the Session Validator Client for details.

Usage: window.e.utils.v2.auth.reauthenticate()

Returns: Promise — resolves to the result of the reauthentication process.

Example

window.e.utils.v2.auth.reauthenticate().then(result => {
if (!result) { return; }
return doSensitiveOperation();
});