Getting error "faultcode":"Server", "faultstring":"Authentication challenge issued.

niveditakumari
Mega Sage

Hello, 

I am getting error when calling rest message "faultcode":"Server", "faultstring":"Authentication challenge issued. 

Earlier it was working fine but it is not working. 

Below is my code : 

try {
var r = new sn_ws.RESTMessageV2('Get PlannedEvents Data - live', 'GET');

//override authentication profile
authentication_type ='basic';
r.setAuthenticationProfile(authentication_type, '3394f9fe1b8ccc9077694005bd4bcbe1');

var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();

//gs.print(responseBody);
gs.log("response body is" + responseBody);
var obj = JSON.parse(responseBody);

var gdt = new GlideDateTime();
var tz = Packages.java.util.TimeZone.getTimeZone("GMT"); //sets to IST
gdt.setTZ(tz);

for(var i = 0; i<obj.plannedEvents.length; i++) {

var gr = new GlideRecord('u_tcl_plannedevents');
gr.addQuery('u_ticket_id', obj.plannedEvents[i].ticketId);
gr.query();
if (!gr.next()) {
gs.log("insert records");
gr.initialize();

var Event_start_date = obj.plannedEvents[i].plannedEventStartDate;
gdt.setValue(new GlideDateTime(Event_start_date));
gr.u_plannedevent_start_date = gdt.getDisplayValue();
gs.log("Start and end dates are "+Event_start_date_1+"---"+Event_end_date_1);
var Event_end_date = obj.plannedEvents[i].plannedEventEndDate;
gdt.setValue(new GlideDateTime(Event_end_date));
gr.u_plannedevent_end_date = gdt.getDisplayValue(); 

gr.insert();
}

}

 

Can anyone please help me with this. 

 

Regards, 

Nivedita

1 ACCEPTED SOLUTION

go to the "sys_auth_profile_basic" table and see user details,

 

if you are accessing other tool api then you will get the credentials from the team who manage that tool. 

if its related to other application ( which is not in service-now ) then connect with the team who gave you the credentials details.

View solution in original post

6 REPLIES 6

Harsh Vardhan
Giga Patron

can you test your rest message "Get PlannedEvents Data - liveGet PlannedEvents Data - live"  get method , see what are you getting as status code ?

I am getting below 

find_real_file.png

check the user credentials , is that correct ? make sure account is not locked 

User profile should show under all users?