OAuth inside PWA in iOS takes you out of PWA and in to Safari

I’ve created a service which relies on the user logging in with their Patreon account. If their pledge is > X they get access to exclusive content. This works. Yey! But when you add the site/app to your home screen on iOS and open it from the home screen this happens:

  1. The user hits the “Log in with Patreon” button
  2. If the user has the Patreon app installed, iOS opens this app for authentication. If not you’re sent to Safari.
  3. Either way you’re sent to Safari after login since the callback URL from Patreon is a web page.

Here’s a screen capture to illustrate the problem.

Is there a workaround with this? I’ve tried using popup screens for the OAuth to keep everything in the same site and closing it when authentication is finished, but the popup can’t be closed programmatically when it’s inside a PWA.

Thanks!

I believe there is a specific url in Android that you can use to get the user back to your app which can be used as a redirect uri. I suspect iOS should have one too. Try using such an url as a redirect uri.