Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

With Developer instances we are unable to create SNOW Incidents using Table APIs, it returns 401

User739474
Tera Contributor

Created a fresh developer instance and tried creating INC using Table APIs, it's returning 401 Unauthorized error. This was working till last month(~).

From SNOW portal - REST API Explorer page it works using X-UserToken header, but from Postman it doesn't work neither with X-UserToken nor with Basic base64{user:pass}.

We have this working at least from last 8 years, but now it suddenly stopped and returning this error. Any recent changes done in Authorizations to this API?

REQUEST and RESPONSE details:

 

POST

https://dev435431.service-now.com/api/now/table/incident


Headers:
Content-Type:application/json
Accept:application/json
Authorization:Basic Base64Encoded{user:pas}

RequestBody:

{
"short_description": "title",
"description": "description body",
"impact": "3",
"urgency": "3"
}

 


Response: 401 Unauthorized
{
"error": {
"message": "User is not authenticated",
"detail": "Required to provide Auth information"
},
"status": "failure"
}

1 ACCEPTED SOLUTION

IbrarA
Tera Guru

Hi @User739474 , 

Nothing changed in the Table API. New developer instances now come with the basic auth restriction turned on, and Basic auth gets blocked unless the account has the snc_basic_auth_api_access role. That's also why the REST API Explorer still works, since it runs on your logged in session instead.

You can check sys_user_basic_auth_exception to see whether your user is listed there. Adding the exception alone may not be enough, so it's worth giving the account the snc_basic_auth_api_access role directly.

It's also worth checking MFA on that user, as Basic auth can't get past it and returns the same 401.

Someone hit the same thing here: https://www.servicenow.com/community/developer-forum/curl-command-to-my-pdi-get-quot-user-is-not-aut...

 

 

Thanks

ibrar

View solution in original post

2 REPLIES 2

IbrarA
Tera Guru

Hi @User739474 , 

Nothing changed in the Table API. New developer instances now come with the basic auth restriction turned on, and Basic auth gets blocked unless the account has the snc_basic_auth_api_access role. That's also why the REST API Explorer still works, since it runs on your logged in session instead.

You can check sys_user_basic_auth_exception to see whether your user is listed there. Adding the exception alone may not be enough, so it's worth giving the account the snc_basic_auth_api_access role directly.

It's also worth checking MFA on that user, as Basic auth can't get past it and returns the same 401.

Someone hit the same thing here: https://www.servicenow.com/community/developer-forum/curl-command-to-my-pdi-get-quot-user-is-not-aut...

 

 

Thanks

ibrar

After adding user_role: snc_basic_auth_api_access for admin user, issue is resolved.