Hello, guys!
The application I’m currently working needs to access a private URL to see the image. As far as I could read in photo viewer’s documentation, there’s a key called headers
where I should add all headers parameters.
The problem is, it seems it doesn’t work on Ionic 3. While I was debugging, I could find the following code snippet:
export interface PhotoViewerOptions { share?: boolean; }
- Isn’t
headers
expected to be declared within PowerViewerOptions? - In case
headers
is not recognized as a valid key on the Ionic Plugin, how could I access a private URL link then?
Here is what I’ve done so far:
async viewEvidence(file: any) {
if (file.uri.includes('https:')) {
const options = await this.getImageViewerOptions();
this.photoViewer.show(file.uri, file.fileName, options);
} else {
this.photoViewer.show(file.uri, file.fileName, { share: false });
}
}
private getImageViewerOptions(): Promise<any> {
return this.storageService.get('access_token').then(token => {
const options = {
share: false,
headers: `{Authorization: Bearer ${token}}`
};
return Promise.resolve(options);
});
}
Thanks!