6 Replies Latest reply on May 7, 2015 12:00 AM by nilsheuer

    How to make Basic Auth call using jQuery?

    gfu

      Hi,

       

      I tried to query my inbox count with jQuery, but it always returns 401 Unauthorized. I am sure the username and password are correct. What could be the issue?

       

      $.ajax({
            type: 'GET',
            url: 'https://devrygroup.jiveon.com/api/core/v3/inbox/counts',
            dataType: 'jsonp',
            async: false,
            headers: {
                'Authorization': "Basic " + btoa(USERNAME + ":" + PASSWORD)
            },
            data: "{'comment'}",
            success: function(result) {
                alert(result);
            }
      });
      

       

      Thank you!