PricingBlog

Should I manually set authorization header if content type is multipart/form-data?

  • prettycold_-1285899016223199306

    Sam B

    1 year ago

    I followed @NoCode ProCode 's video to upload file. I tried a standalone example and it works like a charm.

    I then went ahead and implemented in my original flow which requires authentication at each step. Usually I set Bearer access token against Authorization dropdown. Since this one has files as part of the form, I set the content-type as multipart/form-data.

    When I invoke the corresponding Xano API, I get "Unauthorized - Authentication Required,". When I check the request headers, it doesn't have Authorization as a header.

    I then tried to manually set the header, but not quite sure as to how to pass the access token against it.

    Any ideas?
    1
  • nocodeprocode-1285910526706061362

    NoCode ProCode

    1 year ago

  • neville9288-1285915089521741874

    Neville

    1 year ago

    Following up on @NoCode ProCode , I took the approach of doing my file uploads and subsequent processing without any authentication. The more sensitive stuff (getting, displkaying and modifying data) is all done with authorization in place.
  • 1110963297630568508-@NoCode ProCode
    prettycold_-1285932881029500959

    Sam B

    1 year ago

    Did you say 3 am? Wow, you're up so early 😱 . Thanks for taking the time to reply, much appreciated 🤩 .

    Alright, I see what you're saying. I can make the upload API to be unauthorized from both front end and back end. When you say set the file to expire in 'x' hours, where does that usually happen?
  • Tod-1285932887572742181

    Tod

    1 year ago

    Great energy @Sam B! Your continuous contribution to the toddle Community just made you advance to Community Level 5!
  • prettycold_-1285933007508865087

    Sam B

    1 year ago

    Thanks @Neville , let me also take the same route as you and see how it goes
  • nocodeprocode-1285933069987086347

    NoCode ProCode

    1 year ago

    You can setup a background task in xano 😉
  • prettycold_-1285933200723546215

    Sam B

    1 year ago

    Ah okay. I'll check that out. Thanks again!
  • nocodeprocode-1285933547227713656

    NoCode ProCode

    1 year ago

    You're most welcome 😉