I have implemented OIDC Connect authentication in my application and IDP is PingOne. The authentication flow is working as expected. IDP returns both AccessToken and IDToken in the api as part of authentication. However Pega is only saving IDToken to Clipboard pages and AccessToken is not saved to any page on clipboard. How do i retrieve/get the AccessToken in the post authentication activity. After authentication, We have a requirement to call external API by passing AccessToken as parameter to login/authenticate user in external system and retrieve the token from external system and use the token in the subsequent API calls to the external system.
// get AccessToken from IDP
String accessToken = oauth2Client.getAccessToken();
// Process the Access Token in jwt format to Json
// Map the JSON Token Data to StepPage
Note: Pega also stores Access Token in DB in Table PR_DATA_TOKEN - Access Token, Client ID, Scope etc are stored in this table
Hope this helps !
Posted: 11 months ago
Posted: 13 Oct 2022 6:37 EDT
Mohammed Burhanuddin (MohammedB9117)
To capture the access token and refresh token in the clipboard after OIDC authentication, you can create a Post Authentication Activity. In this activity, you can access the access token and refresh token from the Data-Admin-Security-AccessTokenKeys instances. You can then store these tokens in the clipboard for future use.
To access the tokens, you can use the Obj-Browse method in your activity to search for instances of Data-Admin-Security-AccessTokenKeys with the appropriate criteria, such as the user identifier or client ID. Once you have retrieved the tokens, you can store them in the clipboard using the Property-Set method.
Please note that you should handle the tokens securely and consider the best practices for managing sensitive data in your application.