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

Open
jvitor83 opened this Issue Oct 23, 2018 · 9 comments

Comments

Projects
None yet
5 participants
@jvitor83
Copy link

jvitor83 commented Oct 23, 2018

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

This comment has been minimized.

@jvitor83

This comment has been minimized.

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!

@psachs21

This comment has been minimized.

Copy link

psachs21 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

This comment has been minimized.

Copy link

digitaltickle commented Dec 27, 2018

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

This comment has been minimized.

Copy link
Collaborator

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

This comment has been minimized.

Copy link
Collaborator

samthor commented Jan 26, 2019

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

@Chris-KCIT

This comment has been minimized.

Copy link

Chris-KCIT commented Feb 25, 2019

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

This comment has been minimized.

Copy link
Collaborator

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

This comment has been minimized.

Copy link

Chris-KCIT commented Feb 26, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.