We are getting audience in addQueryParameter('audience','unique id '); No idea how we are getting ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
We are getting audience in addQueryParameter('audience','unique id '); No idea how we are getting?
addQueryParameter data we are storing in the application registry.
Kindly help me to resolve this puzzles.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Most likely the audience value is coming automatically from the OAuth/Application Registry configuration, not from addQueryParameter() itself.
Check:
- System OAuth > Application Registry
- Connection & Credential Alias
- OAuth Entity Profile
Search globally for:
audienceVery commonly, ServiceNow injects it automatically for OAuth/JWT flows (Azure, Okta, etc.).
Also check the outbound REST log to see the final generated request.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @J P Rohini
1. Check if any rest message you have query parameter where you have passed Audience
Refer: KB2524284 OAuth Authentication Not Supported with 'Audience' as Parameter
If yes, remove that from there. As per KB follow this workaround:
Below is a custom workaround,
1. Extend the OAuthUtil Script Include by creating a new Script Include that extends the out-of-the-box OAuthUtil Script Include.
2. Override the interceptRequestParameters function in the new Script Include.
3. Add the custom 'audience' parameter inside the overridden interceptRequestParameters function.
4. Implement the proposed approach in the system to include the 'audience' parameter in the request body.
Example implementation:
var OauthCustomUtil = Class.create();
OauthCustomUtil.prototype = Object.extendsObject(OAuthUtil, {
interceptRequestParameters: function(requestParamMap) {
// Add the 'audience' parameter
requestParamMap.put('audience', 'write_URL');
// Call the parent method to ensure other parameters are handled
this.preprocessAccessToken(requestParamMap);
},
type: 'OauthCustomUtil'
});
Since it is a work-around, I would strongly recommend validating it in a lower instance first. Please also avoid modifying the out-of-the-box Script Include directly.
2.In modern ServiceNow, Audience is primarily defined as user criteria to control which users see specific UI Builder pages . Refer: Add an audience to your UI Builder page
