cancel
Showing results for 
Search instead for 
Did you mean: 

Basic auth in simple Ajax code

msananikone
New Member

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="}
})
 
});

 

New Here?
Join us and watch the welcome video:
Top Kudoed Authors