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
| Name | Type | Required | Description |
|---|---|---|---|
integrationName | string | yes | The name of the integration |
Returns: Promise — resolves to the Authentication Token string.
JWT Fields (Engagement Cloud)
| Field | Type | Description |
|---|---|---|
adminId | number | adminId of logged-in admin |
customerId | number | customerId of logged-in customer |
environment | string | Name (domain) of current environment |
language | string | Preferred language of logged-in admin |
msid | string | Master session ID |
sapGlobalUserId | string | SAP Global User ID |
exp | number | Expiration time (JWT) |
iss | string | Token issuer (JWT) |
auditContext | object | Further session info |
JWT Fields (EMSAdmin)
| Field | Type | Description |
|---|---|---|
customerId | number | customerId of currently selected customer |
environment | string | Name (domain) of current environment |
isAdmin | boolean | Is the logged-in staff member an admin |
staffId | number | Id of current staff member |
exp | number | Expiration time (JWT) |
iss | string | Token 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();
});