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) {
  • 3
    Uh, what's wrong with the above code? Any error message? Please update your question for clarification. Many thanks
    – leymannx
    Aug 21, 2020 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, 2020 at 11:02
  • I mean how can we download file using the basic auth instead of using the cookie.
    – shanidkv
    Aug 23, 2020 at 4:08


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.