logo

NJP

Help! I lost access to my Instance due to Web service access only

Import · Feb 07, 2020 · article

Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

Hi there,

Ever lost your GUI access to your (Personal Developer) Instance? Because of activating the Web service access only checkbox on your User record? It could happen, and looking at several recent Community posts, I thought let's write down a simple solution. A solution that you can revert this change, without needing the Instance Help Community and ServiceNow employees to fix this for you.

Note: Best advice though would be, please DON'T work under the out-of-the-box System Administrator User on your (Personal Developer) Instance.

Web service access only

A short recap about the Web service access only checkbox on the User form lay-out, from the Docs:

"Non-interactive users can only connect to ServiceNow from an API protocol".

When having the Web service access only checkbox checked and trying to login to the GUI, you will be presented with:

image

Removing Web service access only

Reading the Docs again: "API protocol". That gives an idea. It's a bit tricky, though from another ServiceNow instance you might be able to execute a REST call to update the user record!

Code like below should update the web_service_access_only field. Code which I basically generated using the out-of-the-box REST API Explorer from ServiceNow. You can execute the through for example Background script.

(function() {

    var request = new sn_ws.RESTMessageV2();
    request.setEndpoint('https://your-instance.service-now.com/api/now/table/sys_user/6816f79cc0a8016401c5a33be04be441');
    request.setHttpMethod('PATCH');
    //Eg. UserName="admin", Password="admin" for this code sample.
    var user = 'admin';
    var password = 'admin';
    request.setBasicAuth(user, password);
    request.setRequestHeader("Accept", "application/json");
    request.setRequestHeader('Content-Type', 'application/json');
    request.setRequestBody("{\"web_service_access_only\":\"false\"}");
    var response = request.execute();

})();

1) Update the instance you are after in request.setEndpoint2) The sys_id in request.setEndpoint should be the sys_id of the User record you are after, the sys_id currently displayed is the out-of-the-box System Administrator

3) Update var user and var password, with your User ID and Password

View original source

https://www.servicenow.com/community/articles/help-i-lost-access-to-my-instance-due-to-web-service-access-only/ta-p/2326416