{"action":"opened","issue":{"url":"https://api.github.com/repos/angular/angular/issues/23425","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/23425/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/23425/comments","events_url":"https://api.github.com/repos/angular/angular/issues/23425/events","html_url":"https://github.com/angular/angular/issues/23425","id":315341402,"number":23425,"title":"Service Worker forces 401 status when using HTTP-Authentication","user":{"login":"NCC1701M","id":7260053,"avatar_url":"https://avatars0.githubusercontent.com/u/7260053?v=4","gravatar_id":"","url":"https://api.github.com/users/NCC1701M","html_url":"https://github.com/NCC1701M","followers_url":"https://api.github.com/users/NCC1701M/followers","following_url":"https://api.github.com/users/NCC1701M/following{/other_user}","gists_url":"https://api.github.com/users/NCC1701M/gists{/gist_id}","starred_url":"https://api.github.com/users/NCC1701M/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NCC1701M/subscriptions","organizations_url":"https://api.github.com/users/NCC1701M/orgs","repos_url":"https://api.github.com/users/NCC1701M/repos","events_url":"https://api.github.com/users/NCC1701M/events{/privacy}","received_events_url":"https://api.github.com/users/NCC1701M/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-18T05:59:58Z","updated_at":"2018-04-18T05:59:58Z","closed_at":null,"author_association":"NONE","body":"## I'm submitting a...\r\n<!-- Check one of the following options with \"x\" -->\r\n<pre><code>\r\n[ ] Regression (a behavior that used to work and stopped working in a new release)\r\n[X] Bug report  <!-- Please search GitHub for a similar issue or PR before submitting -->\r\n[ ] Performance issue\r\n[ ] Feature request\r\n[ ] Documentation issue or request\r\n[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n[ ] Other... Please describe:\r\n</code></pre>\r\n\r\n## Current behavior\r\nWhen using the service worker with web apps which are using HTTP authentication (in this case Windows authentication) the ngsw.json?ngsw-cache-bust= runs into a 401 status.\r\n\r\n\r\n## Expected behavior\r\nThe 401 status should not be happen.\r\n\r\n\r\n## Minimal reproduction of the problem with instructions\r\nCreate a angular service worker project like described here [https://angular.io/guide/service-worker-getting-started](https://angular.io/guide/service-worker-getting-started) enable some kind of Authentication e.g. Windows authentication\r\n\r\n## What is the motivation / use case for changing the behavior?\r\nThe motivation is that service workers should work with authentication.\r\n\r\n## Possible solution\r\nIn the ngsw-worker.js file change the implementation of the newRequest method of the Adapter class to the following\r\n````ts\r\nnewRequest(input, init) {\r\n  init = init || {};\r\n  if (!init.credentials) {\r\n    init.credentials = 'same-origin';\r\n  }\r\n  return new Request(input, init);\r\n}\r\n````\r\n\r\n\r\n## Environment\r\n\r\n<pre><code>\r\nAngular version: 5.2.10\r\n<!-- Check whether this is still an issue in the most recent Angular version -->\r\n\r\nBrowser:\r\n- [X] Chrome (desktop) version XX\r\n- [ ] Chrome (Android) version XX\r\n- [ ] Chrome (iOS) version XX\r\n- [ ] Firefox version XX\r\n- [ ] Safari (desktop) version XX\r\n- [ ] Safari (iOS) version XX\r\n- [ ] IE version XX\r\n- [ ] Edge version XX\r\n \r\nFor Tooling issues:\r\n- Node version: 8.9.4\r\n- Platform:  Windows\r\n"}}
{"actor":{"display_login":"NCC1701M"}}