generateAuth of SN_AUTH API throws exception for users other than System Admin.

DH7
Tera Contributor

We have built one custom scoped application in which we are fetching the data from the AWS SQS Queue using the REST MessageV2 API and SN_AUTH API

 

In order to fetch the data from the AWS SQS Queue, we will have to sign our request using the generateAuth() method of the sn_auth.RequestAuthAPI() API and make the REST call using the RESTMessageV2 API.

 

Now this works fine if the code is run by the ServiceNow System Admin, but when we try to run the code from our App admin, it's throwing the error "java.lang.NullPointerException".

 

Our App Admin has the following roles:
itil
itil_admin
sn_si.admin
flow_operator
workflow_admin
mid_server
sn_ti.malicious_attachment_access
sn_ti.observable.write

 

We also tried adding all the roles mentioned in the System Admin except for the "admin" role to our App admin role, but it still did not work.

 

Can someone help us determine what could be the reason for this exception and how to resolve it?

Thanks

5 REPLIES 5

ceg
Tera Contributor

Hi,

 

I am working on this generateAuth method. I am still confused on how to use or to work using the generateAuth() method of the sn_auth.RequestAuthAPI() API and make the REST call using the RESTMessageV2 API. Could you please help me to provide the step by step screenshot on how your using it?

Fissuring
Tera Contributor

Any luck here? I am trying the same. It runs well in background script but doesnt work in scripted rest API

 

Abhijit
Tera Expert

did you try scope to scope settings Scope-to-scope settings (servicenow.com)

 

 

ceg
Tera Contributor

Hi,

 

I want to generate a AWS signature dynamically. So I can across about generateAuth(). so I have created the authentication algorithm and so on . But I am not sure on how to use/where to use/how to call it from background script using generateAuth() method of the sn_auth.RequestAuthAPI() API and make the REST call using the RESTMessageV2 API. So thought of asking you about the step by step procedure with screenshot.. so that It will be helpful to generate AWS signature dynamically?