Unable to provide basic auth for scripted rest API

eashwar
Tera Contributor

Hello,

I created a scripted REST API and selected requires authentication but unable to specify the basic auth credentials.

It does not show me an option to do it.

Any guidance ?

 

Thank you,

Easwar

1 ACCEPTED SOLUTION

Thats Correct. If you check the Requires Authentication checkbox, any user can get authenticated with correct credentials. It can be Basic or OAuth(Resource Owner Password Grant). The ACL security evaluates the Roles of the Authenticated user agains the Resource that is being accessed. In your case ITIL role users can access the resource. Also make sure user has other roles required to access the resource. If you are using a Service Account for this integration, make sure you check the Web Service Access only checkbox on the sys_user record for the service Account. https://community.servicenow.com/community?id=community_blog&sys_id=b4fca2a5dbd0dbc01dcaf3231f961900

View solution in original post

6 REPLIES 6

Hi @eashwar ,

You can add an API access policy to your API if you want to apply a policy to your API.

With an API access policy, you can control

  • which authentication method is allowed for the API. example only OAuth, Only mTLS
  • Which all users can access this API (based on user role or group membership)
  • From which all IP ranges this API can be invoked.

Thanks,

Randheer

SanjivMeher
Kilo Patron
Kilo Patron

You only need Basic Auth Crendentials, when you are creating a Outbound REST API. That is, when you are sending a request to a 3rd party system which has exposed a REST API to ServiceNow. You need to 3rd party credentials to be passed as basic auth from ServiceNow to authenticate.

 

Scripted REST API is for inbound Request. So you are building a Scripted REST API to be consumed by a 3rd Party. So the 3rd party will send the request to ServiceNow and they should send credentials from their end to validate to authenticate in ServiceNow.


Please mark this response as correct or helpful if it assisted you with your question.