{"action":"created","issue":{"url":"https://api.github.com/repos/sayanee/angularjs-pdf/issues/80","labels_url":"https://api.github.com/repos/sayanee/angularjs-pdf/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/sayanee/angularjs-pdf/issues/80/comments","events_url":"https://api.github.com/repos/sayanee/angularjs-pdf/issues/80/events","html_url":"https://github.com/sayanee/angularjs-pdf/issues/80","id":121786050,"number":80,"title":"There is no way to set Authentication Header","user":{"login":"gimoteco","id":510168,"avatar_url":"https://avatars.githubusercontent.com/u/510168?v=3","gravatar_id":"","url":"https://api.github.com/users/gimoteco","html_url":"https://github.com/gimoteco","followers_url":"https://api.github.com/users/gimoteco/followers","following_url":"https://api.github.com/users/gimoteco/following{/other_user}","gists_url":"https://api.github.com/users/gimoteco/gists{/gist_id}","starred_url":"https://api.github.com/users/gimoteco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gimoteco/subscriptions","organizations_url":"https://api.github.com/users/gimoteco/orgs","repos_url":"https://api.github.com/users/gimoteco/repos","events_url":"https://api.github.com/users/gimoteco/events{/privacy}","received_events_url":"https://api.github.com/users/gimoteco/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sayanee/angularjs-pdf/labels/documentation","name":"documentation","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-12-11T20:30:00Z","updated_at":"2016-01-05T01:42:19Z","closed_at":null,"body":"When I get a pdf from secured source (through bearer token) I can't set a the requisition headers."},"comment":{"url":"https://api.github.com/repos/sayanee/angularjs-pdf/issues/comments/168865371","html_url":"https://github.com/sayanee/angularjs-pdf/issues/80#issuecomment-168865371","issue_url":"https://api.github.com/repos/sayanee/angularjs-pdf/issues/80","id":168865371,"user":{"login":"sayanee","id":413879,"avatar_url":"https://avatars.githubusercontent.com/u/413879?v=3","gravatar_id":"","url":"https://api.github.com/users/sayanee","html_url":"https://github.com/sayanee","followers_url":"https://api.github.com/users/sayanee/followers","following_url":"https://api.github.com/users/sayanee/following{/other_user}","gists_url":"https://api.github.com/users/sayanee/gists{/gist_id}","starred_url":"https://api.github.com/users/sayanee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sayanee/subscriptions","organizations_url":"https://api.github.com/users/sayanee/orgs","repos_url":"https://api.github.com/users/sayanee/repos","events_url":"https://api.github.com/users/sayanee/events{/privacy}","received_events_url":"https://api.github.com/users/sayanee/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T01:42:18Z","updated_at":"2016-01-05T01:42:18Z","body":"bf1f7de0a4195fa766315f3e7d929061a2e6eac0 Could you try the [branch code](https://github.com/sayanee/angularjs-pdf/tree/add-http-headers) to add the `http headers'? \r\n\r\nYou can add it in the controller, example:\r\n\r\n```\r\n$scope.pdfUrl = 'pdf/relativity.pdf';\r\n$scope.httpHeaders = {\r\n     ...   \r\n}\r\n```\r\n\r\nHere's a [similar example based on pdf.js](https://groups.google.com/forum/#!topic/mozilla.dev.pdf-js/iDUqbjMRcGc) or [an explanation](https://github.com/mozilla/pdf.js/issues/4082#issuecomment-31784231)\r\n\r\nIt seems we need to add `httpHeaders` by looking at the [current pdf.js source](https://github.com/mozilla/pdf.js/blob/master/src/display/api.js#L265):\r\n\r\n```\r\n* @property {string}     url   - The URL of the PDF.\r\n * @property {TypedArray|Array|string} data - Binary PDF data. Use typed arrays\r\n *   (Uint8Array) to improve the memory usage. If PDF data is BASE64-encoded,\r\n *   use atob() to convert it to a binary string first.\r\n * @property {Object}     httpHeaders - Basic authentication headers.\r\n * @property {boolean}    withCredentials - Indicates whether or not cross-site\r\n *   Access-Control requests should be made using credentials such as cookies\r\n *   or authorization headers. The default is false.\r\n```"}}