User Not Authenticated - Required to Provide Auth Information

tiguin2798
Tera Guru

Good morning,

I am fairly new to ServiceNow and trying to set up an API to go from one of our SharePoint forms to create an incident in our instance. I think we have everything almost there as we were receiving the incidents in test until we added the body. Once we added the body as provided by "Rest API Explorer" we started receiving an error both in Nintex and PowerAutomate.

{"error":{"message":"User Not Authenticated","detail":"Required to provide Auth information"},"status":"failure"}

I did create a user specifically for this API. I have tried adding this both in our Nintex workflow as the user account and in the body. It is not locked out and also has the following roles.

 

NOTE: I added the role snc_platform_rest_api_access to the default ACL "Scripted REST External Default" as I was not finding the role snc_external (even as an elevated admin user).

tiguin2798_0-1710851280892.png


I have also tried with the user being given the admin role, as well as with Authorization (and no ACLs) being turned off both in the resource and API definition. Below is the script the "Rest API Explorer" gave me for the body which I added in the API Resource linked to the definition. I did change where it had admin to include the username and password of the user we wished to use. Is there something I am missing?

tiguin2798_1-1710852892317.png

 

Thank you!


 

5 REPLIES 5

Amit Pandey
Kilo Sage

Hi @tiguin2798 

 

There seems to be a problem with your endpoint. I think it is of a Table API and for a GET call. Please create one for POST call and then try. Also, set the Web service access only to true in user form.

 

Regards,

Amit

Thanks Amit! I am a little confused on this however. The way I went through creating the script which provided the endpoint was going through "Create Incident - Post" and it does show POST in the script.

This is the script in ServiceNow I was using.

request.setEndpoint('https://xxxxxxxx.service-now.com/api/now/table/incident?sysparm_display_value=active%3Dtrue&sysparm_exclude_reference_link=true&sysparm_fields=true');
request.setHttpMethod('POST');

 This is the script we used in Nintex in Java format.

var client=new XMLHttpRequest();
client.open("post","https://xxxxxxx.service-now.com/api/now/table/incident?sysparm_display_value=active%3Dtrue&sysparm_exclude_reference_link=true&sysparm_fields=true");

Additionally, when you say to set Web service access only to true in user form, is this something within ServiceNow?

Hi @tiguin2798 , 

Are you trying the scripted REST API and sharing the custom endpoint to Nintex and PowerAutomate.

If that's the case, then you don't need to setEndpint and setHttpMethod script.

 

did you created a scripted rest api endpoint ( table : sys_ws_definition )

AshishKMishra_1-1710859986312.png

 

did you create a scripted rest resource ( get or post ) ( table : sys_ws_operation )

 

AshishKMishra_0-1710859956034.png

 

Please share screen shot of whole page ( hide the client specific details )

 

-Thanks,

AshishKM

 

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

@AshishKM  Hello!
I have another teammate that is entering the Nintex information, but from what I've seen we have been including the endpoint in the entire body as was provided by ServiceNow in addition to adding the POST URL that I have listed in the 3rd screenshot below. It is a scripted API with a linked resource as well as the headers being provided.
tiguin2798_1-1710861056333.pngtiguin2798_2-1710861060387.pngtiguin2798_3-1710861062998.png