Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to load the progressive web app manifest file from authenticated site? #535

Closed
svdoever opened this issue Dec 6, 2016 · 15 comments

Comments

@svdoever
Copy link

svdoever commented Dec 6, 2016

I'm having the progressive web app index.html page and assets in a SharePoint document library. I need to authenticate when accessing the index.html page. But the manifest.json file as linked as does not have the required authentication cookie when requested from the index.html page. Note that SharePoint does not serve .jon files, that is why it ends with .txt. Is there a way to retrieve the manifest from an authenticated site?

It works when I have the manifest on an anonymously accessible location, i.e. outside of SharePoint (I now use my dropbox). In that case I need to specify a full path for the start_url. But this is not a really nice deployment model because I need to deploy files to two different locations...

@marcoscaceres
Copy link
Member

This also sounds like a bug in Chrome: loading manifest should send the same information along as any other <link>ed resource.

@RobDolinMS
Copy link
Contributor

@svdoever Building on @marcoscaceres's suggestion, would you please try testing in Edge, Internet Explorer, and/or Firefox and let folks know if the issue can be reproduced in multiple web browsers.

@dominickng
Copy link
Collaborator

I believe that you must specify crossOrigin="use-credentials" in the manifest link tag to allow the manifest fetch to use cookies and credentials in Chrome.

@svdoever
Copy link
Author

svdoever commented Dec 7, 2016

@dominickng you are a hero! crossOrigin="use-credentials" did the job!

@dominickng
Copy link
Collaborator

Closing as fixed. :)

@marcoscaceres
Copy link
Member

Thanks @dominickng! My bad for assuming it was a bug in Chrome.

@svdoever
Copy link
Author

I still think that all hrefs to same domain should get the authentication headers passed through... other assets can be loaded without the crossOrigin property.

@marcoscaceres marcoscaceres reopened this Jan 25, 2017
@marcoscaceres
Copy link
Member

I need to check what HTML says. Ideally, I'd like to just follow whatever it says to do wrt loading resources from link relationships.

@HolgerJeromin
Copy link

This behavior is still surprising to me and others.

@mgiuca
Copy link
Collaborator

mgiuca commented Nov 5, 2018

My reading of the spec is that by default, a <link> should make a non-CORS reqest including credentials.

From my reading of the HTML spec, I compiled this table.

In summary:

  • The default behaviour should be a non-CORS request with credentials.
  • crossOrigin="anonymous" should make a CORS request without credentials unless the request goes to the same origin.
  • crossOrigin="use-credentials" should make a CORS request with credentials.

In all cases, you should get credentials if the request goes to the same origin.

I'm not quite sure what a "non-CORS" request is in this default case. It looks fairly restricted.

So this could indeed be a Chrome bug if we aren't passing the credentials along.

@mgiuca
Copy link
Collaborator

mgiuca commented Nov 5, 2018

Since this isn't a spec issue, transferring this to https://crbug.com/901705.

@mgiuca mgiuca closed this as completed Nov 5, 2018
@mgiuca
Copy link
Collaborator

mgiuca commented Nov 5, 2018

OK we had a closer look (with @dominickng). This is a spec issue, because the Manifest spec explicitly overrides HTML's "Obtaining a resource from a link element" algorithm.

https://www.w3.org/TR/appmanifest/#obtaining

So while normal <link> elements send credentials by default, <link rel="manifest"> explicitly does not. This appears to be intentional because it's secure by default, whereas retrofitting it for other link types like icons and style sheets was not possible.

For historical discussions, see:

Looks like this has all been litigated in 2014 and a conclusion was made to override the default behaviour of HTML. Keeping this closed as I don't think it's worth going over this again.

@marcoscaceres
Copy link
Member

Thanks for doing the archeology on it!

@ezekielchentnik
Copy link

Thanks for the archeology, needed this today. Cheers.

@DrewML
Copy link

DrewML commented Jan 24, 2019

If the new behavior for <link rel="manifest"> was designed to model the same defaults as fetch (secure by default), that seems like an unfortunate mismatch now that the fetch spec has been updated to make credentialed requests by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants