pwa-builder / PWABuilder

The simplest way to create progressive web apps across platforms and devices. Start here. This repo is home to several projects in the PWABuilder family of tools.
https://docs.pwabuilder.com
Other
2.54k stars 273 forks source link

[BUG] Google Login Does Not Work Correctly [Video Included!] #4672

Closed AminDhouib closed 4 months ago

AminDhouib commented 4 months ago

Context

I used PWABuilder and I was already able to publish the app (called uNotes https://unotes.net, platform with free study materials) on Google Play. Now I'm trying to publish it to the app store.

Google account login is working on the web (Chrome and Safari) and in the app downloaded from Google Play.

Google OAuth login is working on the web (tested on Chrome and Safari) and in the PWA Android app that is downloaded from Google Play. We are using next-auth (https://next-auth.js.org/) to handle all of the OAuth operations. Our project is Next.JS based.

Here is our pwa config:

import pwa from 'next-pwa'

...
...

const withPWA = pwa({
    dest: 'public',
    runtimeCaching: [
        {
            urlPattern: /\/api\/auth\/.*/,
            handler: 'NetworkOnly',
            options: {},
        },
    ],
})

The Issue

Google login does not work correctly for the iOS PWA of unotes. I have attached a video below that shows the issue.

I have extensively added all of these app-bound domains (WKAppBoundDomains) in the build on Xcode:

apis.google.com
ssl.gstatic.com
drive.google.com
lh3.googleusercontent.com
www.googleapis.com
accounts.youtube.com
accounts.google.com
oauth2.googleapis.com
openidconnect.googleapis.com
securetoken.googleapis.com
gstatic.com
googleusercontent.com
fonts.googleapis.com
myaccount.google.com
payments.google.com
people.googleapis.com

But that did not fix it.

How do we reproduce the behavior?

https://github.com/pwa-builder/PWABuilder/assets/43147238/e1dead95-4c07-470e-aa34-1cd11fa36178

What do you expect to happen?

Clicking Google sign in should allow user to login using Google then it should redirect to the app. Exactly how it works if you attempt to run it through the web version of the website or even on the Android app on Google Play Store.

https://github.com/pwa-builder/PWABuilder/assets/43147238/67f65078-b960-40b0-9400-4414ceadfe40

What environment were you using?

Issue happens when using iOS phones (tested on iPhone 12, iPhone 14, SE 2020). Issue also happens on simulated iPhone 14 on XCode. Though, can assume that all of this does not work correctly on every iOS.

Additional context

No response

khmyznikov commented 4 months ago

Only 10 domains can be added to the list. Domains like fonts don't need to be added, only the domains in redirects chain. See related issues for more hints: https://github.com/pwa-builder/PWABuilder/issues/2433 . If you have only google login, apple probably will reject your app. You need apple login as well or only your custom one.

jgw96 commented 4 months ago

@AminDhouib If you try @khmyznikov 's suggestions and still have problems, please join our Discord https://aka.ms/pwabuilderdiscord to get further help for our iOS platform. Because our iOS platform is experimental, we try to handle most issues over on our Discord in a community lead way.

ghleoperez commented 3 months ago

Hi, Amin.

squale71 commented 1 month ago

Hitting this same issue. Any solutions here that don't require too much Swift knowledge?