arkokoley/pdfvuer

How to preview a pdf file with authorization token enabled

lijiext opened this issue · 1 comments

My project need authorzation to access a pdf file, so how can I add the token header in pdfvuer?

@lijiext

You can use the createLoadingTask to create a loader with your custom token headers.

Use this as an example:

var parameter = {
  url: this.url,
  httpHeaders: { Authorization: `Bearer <Token>` },
  withCredentials: true,
}
this.loadingTask = pdfvuer.createLoadingTask(parameter);

And then the template piece can be:

 <pdfvuer :src="loadingTask" ....