Adding Paramenters to OAuth Request via cloned & modified OAuthUtil script include?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2018 07:56 AM
The oauth endpoint I'm talking to requires another parameter to be added beyond what SN is already adding from the entity profile.
Can anyone help me with an example of how I should be modifying this portion to add my parameter to the request?
interceptRequestParameters : function(requestParamMap) {
// Add/Modify request parameters if needed
this.preprocessAccessToken(requestParamMap);
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2018 06:04 AM
Does the ServiceNow community have tumbleweed awards?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2018 08:20 AM
When you extend OAuthUtil, make sure that the Script Include is a global application. I've tried using a scoped OAuth script, and it errors out.
The parameter map should be a String representation of the parameters that you will be sending. Try something like below:
interceptRequestParameters : function(requestParamMap) {
var json = new JSON();
// Add/Modify request parameters if needed
var paramMap = json.decode(requestParamMap) || {};
paramMap.anotherField = 'test';
this.preprocessAccessToken(json.encode(paramMap));
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2018 03:10 PM
To make the REST token request work correctly for the Azure API, for example, I use this:
interceptRequestParameters: function(requestParamMap) {
// Add/Modify request parameters if needed
requestParamMap.put('resource','https://management.core.windows.net/');
this.preprocessAccessToken(requestParamMap);
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 03:00 PM
Thanks a bunch, this saved me a headache. The documentation just mentions the parameter is a string so decoding/encoding did not work for me.