Set Request body of an Oaut token request in JSON
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2022 11:26 AM
Hi all,
I'm trying to configure a Request Message with Oauth 2 autenthication via Application Registry.
Third party requeriment is that request Body of the Token Request Call should be a JSON with a specific format.
Everything I've tried generates the body like URL parametres, & separated. The only way that I've found is generate de RestMessageV2 or use GlideOAuthClient.
I've also developed an Oauth Api Script but I'm not able to find documentation about oauthContext. oauthContext lets me change headers but I'm not able to change the body
Is there any way to update body request to set it as a json?
Thank you, in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2022 11:08 AM
Hi,
Please look at the setRequestBody(String body) function, it should be useful.
https://developer.servicenow.com/dev.do#!/reference/api/sandiego/server/c_RESTMessageV2API
Best Regards,
Marcin
If my answer helped you in any way, please mark this answer as helpful and correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2022 07:22 AM
Our goal is to use OOB Oauth tools.
RESTMessageV2API is useful to develop Oauth integration from scratch, without using System Oauth > Application Registry, but this is not our goal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2024 05:12 PM
Hey @AdriaM Have you found the solution for this issue? I am having a same case where I need to sent json type string as the request body to retrieve access token by using System Oauth > Application Registry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 04:51 AM
Finally We developed our own Oauth message. We've made the communication in 2 calls. The first one is to retrieve Oauth Token. The second one is the final message containing the previous token. We ask for a new token on every communication.
We use Postman tool tot test how to retrieve the Oauth token. Afterwards is easy to implement inside ServiceNow.
Hope this helps.