Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Unable to use Custom Authentication in Service package



Unable use custom authentication for Service package with the following requirements:
  • Basic Authentication
  • AccessGroup used should be determined by content in service payload

Error Messages

Not Applicable. 

Steps to Reproduce


Root Cause

A defect in Pegasystems’ code or rules.


Perform the following local-change:

When using a custom authentication for a service that is also using Basic Authentication, perform the following steps:
  1. Set the Authentication Service on the Custom tab to use 'Basic Authentication'
  2. Use the following java code to access the authorization header in the Authentication activity:

javax.servlet.http.HttpServletRequest request = 

String authHeader = request.getHeader("authorization");
if (authHeader != null){
   String base64UandP = authHeader.substring(6);
   sUserAndPass = Base64Util.decode(base64UandP);
   oLog.infoForced("UserAndPass: "+ sUserAndPass);
else {
  //Direct processing to error handling in step named ERR
  nextBlock = "ERR";

To read the payload of the data in a SOAP or REST HTTP POST request, use the following Java code in the Authentication activity to get access to the data:

javax.servlet.http.HttpServletRequest request = 

StringBuffer inData = new StringBuffer();
String line = null;

try{ is = request.getInputStream(); br = new, "UTF-8"));
    while ((line = br.readLine()) != null){
}catch (Exception e){
   //Direct processing to error handling in step named ERR
  nextBlock = "ERR";

After these steps, the content is in the StringBuffer inData and can be used further to access the content.
For example, for a JSON type data, include the data to the clipboard and use standard processing to get the data contents.

Example for JSON:

ClipboardPage inDataPage = tools.createPage("","inData");

try {
String someData=inDataPage.getString("SomeDataElement");



Suggest Edit

Published February 20, 2019 - Updated October 8, 2020

Did you find this content helpful? Yes No

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us