openUrl with custom headers

  • 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, etc, but this also must work with Cordova app and I believe the openUrl handles all the quirks that are involved.


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

    if (this.$ {
         openURL('/target-url/pdf/' + token);
     } else {
         this.$http.get('/target-url/pdf', { 
            responseType: 'arraybuffer',
            headers:  {
                'Authorization': 'Bearer ' + token,

  • This post is deleted!

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

    Any ideas?

Log in to reply