qpdfviewer - src: Server-URL with Token for Authorization is truncated
I want to use the qpdfviewer for viewing PDF files that I load from the server. The URL to the server contains a session token.
The URL (attachmentURL) looks something like this: /api/…/4/file?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsic2VtaXNBcHAiXSwidXNlcl9uYW1lIjoia2Vyc3RpbiIsInNjb3BlIjpbImFsbCJdLCJleHAiOjE1OTIzOTgwNzYsImF1dGhvcml0aWVzIjpbIkF1dGhvcml6ZWRCeURhdGFiYXNlIl0sImp0aSI6ImIyNTY4YzE5LWM2OGMtNDMxYy04MjVhLTY4ODliMTk3NjVjZiIsImNsaWVudF9pZCI6InNlbWlzQXBwIn0.1ejO0_7kQFZMRFhEbDODBnrJWZt3HM_7Wv6mO7HQp3A
Unfortunately the request looks like this: http://localhost:8081/api/.../4/file?access_token
Because the token is missing, I receive a Response_Status 401 from the server.
What do I have to do so that I can give the token via the Request in src:?
After a few more tests I assume that the URL is truncated starting with an included “=”
Hawkeye64 last edited by
@kwi This is “pdfjs” you will need to ask them. Unfortunately, I really don’t know much about this part (pdfjs). The app-ext just provides it, mostly for apps that don’t have the HTML 5 PDF reader built in (like Electron and Capicitor).
@kwi Were you ever able to work around your problem? I’m running into the same thing.
@gruppler Figured it out! Just need to run the src through encodeURIComponent first.