How to pass user session id to make REST API request and response into another applications(like c#)

rajkumar5
Tera Contributor

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" );

 

 

2 REPLIES 2

Ashutosh Munot1
Kilo Patron
Kilo Patron

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

rajkumar5
Tera Contributor

Thanks Ashutosh,

Yeah!..Already i have used OAuth Profile registry to make REST API calls using access token as given below screeenshot.

But i want to make API REST calls using user's session id .So could u please help me!!

 

find_real_file.png