No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    openUrl with custom headers

    Help
    2
    3
    588
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      trainerocom last edited by trainerocom

      I need to use openURL to fetch PDF that is behind the authorization. The target URL is not directly the PDF-file, but a PHP script that checks Bearer token from request’s Authorization headers, and then provides the file.

      Is there any way to provide custom headers in openURL call?

      I could do the same by axios, native window.open, etc, but this also must work with Cordova app and I believe the openUrl handles all the quirks that are involved.

      Suggestions?

      Currently I have a workaround with some hacks in backend to check token from query string if not present in headers.

      if (this.$q.platform.is.cordova) {
           openURL('/target-url/pdf/' + token);
       } else {
           this.$http.get('/target-url/pdf', { 
              responseType: 'arraybuffer',
              headers:  {
                  'Authorization': 'Bearer ' + token,
             }
          });
      }
      
      1 Reply Last reply Reply Quote 0
      • T
        trainerocom last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • M
          michaelb last edited by

          I have exactly this issue. I could send the token via the query, but that’s not ideal from a security perspective.

          Any ideas?

          1 Reply Last reply Reply Quote 0
          • First post
            Last post