We were able to successfully achieve this requirement as part of the POC. Below are the details for everyone’s reference.
Use Case
We had a lightweight requirement:
- Embed Pega case creation within an external Angular app
- Only 2 assignments in the flow:
- A form-based assignment
- An attachment upload with additional details
To achieve this, we extracted the required SDK code and libraries from the Constellation SDK project and incorporated them into our Angular application.
Initial Setup (Working Scenario)
Using the standard Pega authentication service:
- We successfully rendered the case screens in embedded mode on clicking a “Create New Request” button
- Case processing (including completion) worked seamlessly
- Localization also functioned as expected
Challenge
The requirement then evolved to use client-side authentication via Microsoft OpenID Connect (MSA). Specifically:
- The token generated via Azure (MSA) needed to be used for authentication
- This token had to be validated against a corresponding operator setup in Pega
The key challenge was during SDK initialization:
- Pega requires user validation before loading Constellation bootstrap data
- This happens via a DX API call to the data page D_pxBootstrapConfig
- Since the SDK was not aware of the externally generated token at this stage, the bootstrap call was failing
Solution
The solution was to ensure that the SDK uses the Azure-generated token before any initialization or bootstrap calls are triggered.
Below is the minimal change we implemented in app.component.ts:
setCustomToken() {
const tokenObject = {
access_token: "..." // Token generated via Azure (MSA)
};
if (tokenObject?.access_token) {
sdkSetAuthHeader(`Bearer ${tokenObject.access_token}`);
}
}
ngOnInit() {
this.initialize();
}
async initialize() {
document.addEventListener('SdkCustomReauth', this.setCustomToken);
this.setCustomToken();
}
What This Fix Achieves
- The Azure (MSA) token is injected into the SDK before any Pega calls are made
- The initial bootstrap request (D_pxBootstrapConfig) now carries this token
- A custom authentication service in the Pega service package validates the token
- Upon successful validation, the operator context is established
Once bootstrap is successfully loaded:
- All subsequent DX API calls reuse the same token
- Case creation and processing work seamlessly within the embedded Angular application
Key Takeaway
When integrating external authentication (like Azure OpenID Connect) with Constellation SDK:
- Ensure the token is set early in the SDK lifecycle
- Specifically, before the bootstrap call is triggered
- This avoids initialization failures and ensures smooth downstream DX API interactions
Below pega documentation link helped us a lot for understanding the SDK working structure and methodology
This was just a POC which was done as part of the preparatory work and hopefully we will be able to overcome the challenges we face (if any) when we implement the full application and promote it to PROD.
Regards
JC