Is there any way we can read the file from server wherein an authentication is required with JWT?

I saw that there is an option to share the link for the link for source path.
Now lets image that we need to read file from server which required authentication to read the file, the user is implemented with JWT i.e. token based in headers.

Now, a HTTP call or headers are required to read the PDF from server.

Is there any way we can achieve this with this package?

1 possible answer(s) on “Is there any way we can read the file from server wherein an authentication is required with JWT?

  1. @xyrintech pass Object with headers to [src] instead of just an URL string:

    pdfObject = {
      url: 'some url to PDF',
      httpHeaders: { Authorization: 'Bearer XYZ' },
      withCredentials: true,
    }
    

    and then in the view

    <pdf-viewer [src]="pdfObject" ...