Process JWT token with Audience array

I’m actually implementing a custom authentication activity with a JWT token inbound like this:
{
“iss”: “XXXXX”,
“sub”: “CN=UT-0001_NP”,
“exp”: 1779353753,
“iat”: 1779350152,
“identity”: “CN=UT-0001_NP”,
“groups”: [
“securityRole”
],
“aud”: [
“Pega_REST_API”
]
}

in my TokenProfile configuration, I mapped sub and aud elements


The property audienceArray was built as ValueList of string, but when I process the token via pxProcessJWT activity i correctly get the “sub” token, but there’s an exception about the “aud” elements:

Step Status FAIL
Step Status Info
 class "java.util.Arrays$ArrayList" does not match mode "String List" of property "operatorPage.AudienceArray".  Details: Invalid value for aValue passed to com.pega.pegarules.data.internal.clipboard.ClipboardPropertyImpl.setValueOverride(Object) 

Which kind of property mode is more suitable for this scenario?

Can you try mapping it to a Page List property of class SingleValue-Text instead?

While I haven’t configured a Token Profile for this specific array scenario, Pega typically handles JSON string arrays (like in REST integration metadata) by mapping them to a Page List using SingleValue-Text rather than a Value List.

The error message you are seeing (java.util.Arrays$ArrayList not matching property mode String List) strongly suggests that the engine is trying to map a Java list collection directly into a structure it expects to be an object-based list. Swapping to a Page List with a single value text class might resolve this mismatch. Let us know if that works!

I tried also with pageList but of class @baseclass but didn’t works; now event with SingleValue-Text I’m getting the same error.

For a JWT claim like aud, the cleanest options are:

  • Use a Text property only if aud is guaranteed to be a single string.
  • Use a Page List / Value List only if the token mapping converts each array item individually.
  • Use a Java Object property if the inbound token processing is handing you the raw JSON array object directly.

In your specific case, because the token contains aud: [“Pega_REST_API”] and Pega is complaining about ArrayList, I would suggest changing operatorPage.AudienceArray to a Java Object property first, then convert it to a string list later if needed in your activity logic.

don’t use String List mode for this claim; use Java Object if you want to preserve the inbound array, or refactor the mapping so the claim is handled as a true list element-by-element.

Hi Ravi, my last attemp was just using a Java Object


and this worsk! Thank you.

S.