0

How can we download the protected files using the REST API by using the BasicAuth? I've tried below code with BasicAuth

var settings = {
  "url": "domain/system/files/guides/docs.pdf",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "Authorization": "Basic uFGAskieuwOnRlc3R1c2V",
    "Content-Type": "application/pdf"
  },
   "data": "<file contents here>"
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
3
  • 3
    Uh, what's wrong with the above code? Any error message? Please update your question for clarification. Many thanks
    – leymannx
    Aug 21 '20 at 6:11
  • It is working with cookie, not with the basic auth in the postman, How postman is setting the cookie value?
    – shanidkv
    Aug 22 '20 at 11:02
  • I mean how can we download file using the basic auth instead of using the cookie.
    – shanidkv
    Aug 23 '20 at 4:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.