{"id":215,"date":"2020-04-14T16:03:46","date_gmt":"2020-04-14T15:03:46","guid":{"rendered":"http:\/\/blog.c-hase.de\/?p=215"},"modified":"2020-04-14T16:03:52","modified_gmt":"2020-04-14T15:03:52","slug":"pdf-inline-with-authorization","status":"publish","type":"post","link":"http:\/\/blog.c-hase.de\/?p=215","title":{"rendered":"pdf inline with authorization"},"content":{"rendered":"<p><a class=\"user-mention\" href=\"https:\/\/github.com\/xyrintech\" data-hovercard-type=\"user\" data-hovercard-url=\"\/users\/xyrintech\/hovercard\" data-octo-click=\"hovercard-link-click\" data-octo-dimensions=\"link_type:self\">@xyrintech<\/a> pass <code>Object<\/code> with headers to <code>[src]<\/code> instead of just an <code>URL string<\/code>:<\/p>\n<pre><code>pdfObject = {\r\n  url: 'some url to PDF',\r\n  httpHeaders: { Authorization: 'Bearer XYZ' },\r\n  withCredentials: true,\r\n}\r\n<\/code><\/pre>\n<p>and then in the view<\/p>\n<div class=\"highlight highlight-text-html-basic\">\n<pre>&lt;<span class=\"pl-ent\">pdf-viewer<\/span> <span class=\"pl-e\">[src]<\/span>=<span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>pdfObject<span class=\"pl-pds\">\"<\/span><\/span> <span class=\"pl-e\">...<\/span><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>@xyrintech pass Object with headers to [src] instead of just an URL string: pdfObject = { url: &#8217;some url to PDF&#8216;, httpHeaders: { Authorization: &#8218;Bearer XYZ&#8216; }, withCredentials: true, } and then in the view &lt;pdf-viewer [src]=&#8220;pdfObject&#8220; &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-215","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/blog.c-hase.de\/index.php?rest_route=\/wp\/v2\/posts\/215","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.c-hase.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.c-hase.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.c-hase.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.c-hase.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=215"}],"version-history":[{"count":1,"href":"http:\/\/blog.c-hase.de\/index.php?rest_route=\/wp\/v2\/posts\/215\/revisions"}],"predecessor-version":[{"id":216,"href":"http:\/\/blog.c-hase.de\/index.php?rest_route=\/wp\/v2\/posts\/215\/revisions\/216"}],"wp:attachment":[{"href":"http:\/\/blog.c-hase.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.c-hase.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=215"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.c-hase.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}