How to authenticate and access Servicenow workflow from .net c# REST API call. Servicenow account having OCTA authentication
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2022 10:21 PM
My organization having Service now account and created workflow and currently accessing through servicenow website. Having the authorization connected with microsoft account. i need to access workflow from .net c# with REST API call.i tried with basic authentication code, but am not able to authorize to access. Can you help me to how to authorize to servicenow account and access the workflow.
var client = new HttpClient();
client.BaseAddress = new Uri("https://XXXXX/nav_to.do?uri=%2Fu_accounts_XXXXX_list.do%3Fsysparm_first_row%3D1%26sysparm_query%3Dactive%253Dtrue%255Eu_assignment_group%2XXXXX484%26sysparm_view%3D");
var request = new HttpRequestMessage(HttpMethod.Post, "/path");
var byteArray = new UTF8Encoding().GetBytes("<clientid>:<clientsecret>");
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
var formData = new List<KeyValuePair<string, string>>();
formData.Add(new KeyValuePair<string, string>("grant_type", "password"));
formData.Add(new KeyValuePair<string, string>("username", "XXXX@lkqcorp.com"));
formData.Add(new KeyValuePair<string, string>("password", "XXXXX"));
formData.Add(new KeyValuePair<string, string>("scope", "all"));
request.Content = new FormUrlEncodedContent(formData);
var response = await client.SendAsync(request);
var contents = await response.Content.ReadAsStringAsync();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2022 10:03 PM
If i use above mentioned login , is it allow me to get workflow data without authorization.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 02:59 AM
you cant access anything without authorization in the platform