Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Getting { message: "User Not Authenticated", detail: "Required to provide Auth information"} While calling ServiceNow Rest Api from Angular Application It Works Fine on POSTMAN but somehow not on Angular

Sandip
Kilo Explorer
Getting { message: "User Not Authenticated", detail: "Required to provide Auth information"} While calling ServiceNow Rest Api from Angular Application  It Works Fine on POSTMAN but somehow not on Angular

requestheaders.append('Accept','application/json'); requestheaders.append('Content-Type', 'application/json'); requestheaders.append('X-UserToken', 'TOKEN'); url = this.link +"/api/now/table/kb_knowledge?sysparm_limit=1"; var authorizationHeader = 'Basic ' + btoa('<UserName>:<Password>'); requestheaders.append('Authorization', authorizationHeader); this.httpClient.get<IlistDataResponse>(this.url,{headers:requestheaders}).subscribe((data)=> { console.log(data.result); }, err => { console.log(err );
3 REPLIES 3

Inactive_Use408
Kilo Expert

I'm having the same problem, but I'm making the call from an Azure DevOps Pipeline and am using bash to generate the base64 authorization header. I feel like there has got to be some header involved that the REST API Explorer in SN is not telling us about. Have you checked Postman to validate all of the headers it is sending?

Nandana
Tera Contributor

Hi Sandip,

 

Is this issue resolved for you? We are also seeing the same issue, Any servicenow API link opening in Chrome is throwing the same xml error.

 

Kindly share how this is fixed for you?

 

Thanks,

Nandana

Saibabu
Kilo Contributor

was it resolved ? I do have same issue and unable to find solution for it

The same curl command works from my local mac but not from azure devops pipelines ( bash/powershell/python) tasks. very strange