How to pass user session id to make REST API request and response into another applications(like c#)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2020 10:06 AM
Could you suggest me to pass user's session id(g_ck) to C# windows application to make REST API calls.
1) Got session id from service-now instance console.And i'm trying to pass session id to make REST calls using session id.
2)Passed session id to make REST request in code and got error ("User Not Authenticated").Please let me know if i missed out anything or used wrong request headers in httpWebRequest.
Code Snippet:
request.Headers.Add("Authorization", "Bearer 95450bffef66c7c1ed06d73da924813d2e33720765d6ed9c49b730a" );

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2020 10:14 AM
Hi,
You just use oAuth for this. You can configure oAuth profile in servicenow and then get the token for login.
If you have azure AD then you can get token from there if integrated with ServiceNOw.
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2020 12:01 AM