sarriaroman / photoviewer

PhotoViewer Cordova Plugin
MIT License
157 stars 216 forks source link

PhotoViewer not passing provided headers on Android #232

Open rolinger opened 1 year ago

rolinger commented 1 year ago

@sarriaroman - Can you comment on this please?

I am implementing various security policies on my webserver, one of which is to check for Origin and X-Requested-With headers. My app, passing the required headers, is able to connect to my server to list photos; but on Android when clicking on those images to display them with photoviewer the connections are being rejected by the server. This tells me that PhotoViewer headers are not being passed or not being passed correctly. It's working on iOS.

With the server security on, the viewer opens and then just immediately closes. If I turn off the server security the images load properly into PhotoViewer

    var headers = {
      'X-Requested-With' : 'com.myapp',
      'Origin' : 'https://myapp/'
    }  ; 
    var options = {
        share: false, // default is false
        closeButton: true, // default is true
        copyToReference: true, // default is false
        headers: JSON.stringify(headers),  // If this is not provided, an exception will be triggered
        piccasoOptions: { } // If this is not provided, an exception will be triggered
    };

Are there any callbacks that allow me to see what exactly is being passed? Or how can I get the Plugin to show me the HTTP Headers used to connect to my server?

rolinger commented 1 year ago

@sarriaroman - bump

rolinger commented 1 year ago

@sarriaroman - Looking further into this, it looks like the provided headers aren't being passed into the Picasso.get().load(mImage) call on line 198 in PhotoActivity.java

I am not familiar with Picasso or how to write java - so not certain how to amend this.

https://stackoverflow.com/questions/24273783/android-picasso-library-how-to-add-authentication-headers/28702345#28702345