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

Remove the manifest from iOS to allow OAuth redirect to works #15

Closed
jvitor83 opened this issue Oct 23, 2018 · 10 comments
Closed

Remove the manifest from iOS to allow OAuth redirect to works #15

jvitor83 opened this issue Oct 23, 2018 · 10 comments

Comments

@jvitor83
Copy link

Lot of people are having issue with redirect at OAuth flow when using the apple-mobile-web-app-capable feature of iOS:

I believe it can be solved by changing the:
<link rel="manifest" href="manifest.json">
to
<link rel="no-on-ios" href="manifest.json">
when on iOS.

It prevent the iOS Safari to process the manifest (which cause the bug)

So, i believe that this pice of code could be inside pwacompat.js to allow many of PWAs use OAuth login:

   var iOS = !!navigator.platform && /iPhone/.test(navigator.platform);
   if(iOS) {
      document.querySelector('link[rel="manifest"]').setAttribute("rel", "no-on-ios");
   }

At least until apple fix this issue (don't know where or if is been tracked).

https://forums.developer.apple.com/thread/100524

@jvitor83
Copy link
Author

jvitor83 commented Nov 6, 2018

@jvitor83
Copy link
Author

jvitor83 commented Nov 9, 2018

For what i could see, the issue is with the manifest (iOS implementation) and not with the apple-mobile-web-app-capable . This is why the workaround works!

@paul-sachs
Copy link

paul-sachs commented Dec 16, 2018

Unfortunately, I think this hack doesn't seem to work anymore. I was just testing it out with my own app on iOS simulator (12.1) and all external links still open safari instead, even without the manifest available. Not sure if something has changed. Tried this without the added complexity of pwacompat, still no dice. Was really hoping to get SSO working but without the redirect, I'm going to have to find another route.

@digitaltickle
Copy link

I just hit this same issue - Auth with redirect is fine for Google and FB within Safari, but as soon as you add the PWA to the homescreen, the Auth process opens in Safari then tries to redirect to Safari too - leaving the PWA un-auth'd. Bugger.

@samthor
Copy link
Contributor

samthor commented Jan 9, 2019

So this seems to me to be a fundamental problem with the way iOS uses PWAs; it's not really anything to do with PWACompat except for the fact that PWACompat configures iOS on your behalf.

I'm not against having a "no-on-ios" modifier, but to me, the primary use-case of this library is to support iOS. So if PWAs aren't working on iOS because you have these kinds of auth flows, I'd probably suggest not using PWACompat for the time being.

@samthor
Copy link
Contributor

samthor commented Jan 26, 2019

In exciting news, looks like new Safari betas might resolve this issue.

@Chris-KCIT
Copy link

I'm not against having a "no-on-ios" modifier, but to me, the primary use-case of this library is to support iOS. So if PWAs aren't working on iOS because you have these kinds of auth flows, I'd probably suggest not using PWACompat for the time being.

For me, I wish to have the manifest in place for non-iOS users and have my site open in browser for iOS users until apple get their act together.

@samthor
Copy link
Contributor

samthor commented Feb 26, 2019

If that's the case, the JavaScript suggested above could be included in your own bundle or inline in the HTML. This just really isn't a PWACompat issue ¯\_(ツ)_/¯

@Chris-KCIT
Copy link

Indeed I have included the above code, it is working very well. As soon as these Safari issues are resolved by Apple I can go back to using PWACompat for my poor iOS users :o for now they will be using our system in a Safari window.

@maku-zuhlke
Copy link

Thanks @samthor. I can confirm that iOS 12.2.0 fixes the issue for us. 🎉🎉🎉

@samthor samthor closed this as completed May 28, 2019
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

6 participants