# How to Implement OAuth Token Exchange (Impersonation) in Pega Cloud with OIDC Authentication?

**URL:** <https://forums.pega.com/t/how-to-implement-oauth-token-exchange-impersonation-in-pega-cloud-with-oidc-authentication/13907>\
**Category:** Pega-as-a-Service\
**Tags:** financial-services, security, pega-platform\
**Created:** [October 30, 2026, 9:53am UTC](https://forums.pega.com/t/how-to-implement-oauth-token-exchange-impersonation-in-pega-cloud-with-oidc-authentication/13907 "2026-10-30T09:53:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrahmeshTech](https://avatars.discourse-cdn.com/v4/letter/b/13edae/32.png) [@BrahmeshTech](https://forums.pega.com/u/BrahmeshTech)\
**Post date:** [October 30, 2026, 9:53am UTC](https://forums.pega.com/t/how-to-implement-oauth-token-exchange-impersonation-in-pega-cloud-with-oidc-authentication/13907/1 "2026-10-30T09:53:38Z")

</div>

Hi,

Currently, our internal users authenticate through custom login logic (legacy implementation), where we capture the complete `TokenResponse` locally and use it for downstream API calls and customer-data access through token impersonation(oauth-token-exchange-impersonation).

As part of our migration to Pega Cloud, we are moving internal users to the standard OIDC authentication flow supported by Pega.

Our new authentication flow works as follows:

- Pega initiates the Authorization Code Flow with PKCE against our Identity Provider .

- Pega securely stores the complete token response in encrypted format in pr\_data\_token and exposes the ID token on the clipboard.

- For downstream API calls, Pega internally retrieves the encrypted access token generated during authentication and passes it to the APIs. This process is platform-managed, and we do not have access to the underlying access token.

**Our challenge:**

For certain use cases, internal users need to retrieve customer-specific information (Loans, Cards, etc.). We currently achieve this using the OAuth Token Exchange / Impersonation flow (`oauth-token-exchange-impersonation`), where we exchange the internal user’s access token with our IDP to obtain an impersonated token.

With Pega Cloud OIDC authentication, we cannot access the underlying encrypted access token to initiate this token exchange.

I also came across a [similar discussion in the Pega Community](https://support.pega.com/comment/1001531), but it doesn’t appear to have a conclusive solution.

**Question:**

Is there a standard or recommended approach in Pega Cloud to implement the OAuth Token Exchange (Impersonation) flow using the access token from SSO session.

Any guidance would be appreciated..

---

<div class="post-metadata">

**Author:** ![Sairohith](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/sairohith/32/23362_2.png) [@Sairohith](https://forums.pega.com/u/Sairohith)\
**Post date:** [November 26, 2026, 8:09pm UTC](https://forums.pega.com/t/how-to-implement-oauth-token-exchange-impersonation-in-pega-cloud-with-oidc-authentication/13907/2 "2026-11-26T20:09:05Z")

</div>

I would recommend keeping the standard OIDC authentication flow in Pega Cloud instead of trying to decrypt the access token from the `pr_data_token` table. One possible approach is to introduce a secure middleware or API gateway where Pega passes the user’s access token through a supported authentication mechanism. The middleware can communicate with the Identity Provider to perform the OAuth Token Exchange and obtain the customer-specific token. Make sure to validate user permissions, customer access, token expiry and maintain proper audit logs. I could not find a documented OOTB approach for this specific token exchange requirement in Pega Cloud.
