Forum Discussion

msananikone's avatar
msananikone
New Member
3 years ago

Basic auth in simple Ajax code

I am trying to make a very simple API call using Ajax. I can change the headers in Python, but can't seem to make it work with Ajax. It may be simple, as I am just getting started with this kind of coding.

 

Curl statement:

curl -X GET "myapiurl" -H "accept: text/plain" -H "authorization: Basic myauthenticationkey="

 

 

$(document).ready(function(){
     $.ajax({
          type: "GET",
          url: "myapiurl",
          headers: {"Authorization": "Basic myauthenticationkey="}
})
 
});

 

No RepliesBe the first to reply