Authentication Issue with REST or BAQ call


(William) #1

As i have been working with the rest API i have been getting around the issues that pop up.

Currently have a HTTPS link to access our rest api where we can make calls to the API to receive back data as a Rest call or as a BAQ. However when we go to use the call in an application that we have it brings back this error.

Exception: The HTTP request is unauthorized with client authentication scheme ‘Anonymous’. The authentication header received from the server was ‘Basic Realm=‘Epicor REST API’’.

We have a cert onto our server and the login is correct when trying to access the API.
Anyone have any help ideas?


(Jose C Gomez) #2

Looks like you are not passing your Authorization header… what does your request look like?


(Bart Elia) #3

I agree with @josecgomez.sixs This is an example from Postman and shows the sending of the Basic auth header:
image


(Alejandro Cortes) #4

Here is an example using jquery

//Credentials
var userNa = ‘USERID:PASS’;
var auth = window.btoa(userNA);

//Coded string to be sent by the Ajax Call
var header = {‘Authorization’:'Basic ’ + auth};

function callFunction(url,methodType,callback) {
$.ajax
({
async: ‘true’,
url: url,
method: methodType,
headers: header,
success: callback,
})
}