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.75k stars 284 forks source link

Apple login in iOS app not working #3151

Open eastupp opened 2 years ago

eastupp commented 2 years ago

Hi,

I'm developing my first application in Bubble: www.quemquerjogar.com.br

I used PWABuilder and I was already able to publish the app on Google Play. Now I'm trying to publish to the app store.

I installed the Sign in with Apple plugin from Zeroqode.

Apple account login is working on the web (windows, android and iOS) and in the app downloaded from Google Play.

But for Apple reviewers it is not working. And it's also not working when I run the app from Xcode.

Clicking the Apple login button does not open the Apple login page, and returns to my application login page.

Please watch the two videos below.

Windows web login https://youtu.be/u653LDdptew

Xcode Login (Macincloud.com) https://youtu.be/emuAPF-FRBE

Can you help me?

Thanks. Regards Emerson

If my answer was in the docs all along, I promise to give $5 USD to charity.

martincout commented 1 year ago

Hi @eastupp , I had the same two issues in my app. For the one on XCode I did this workaround.

In the WebView file change this function code to this.

 func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
    if navigationAction.targetFrame == nil {
        let tempURL = navigationAction.request.url
        var components = URLComponents()
        components.scheme = tempURL?.scheme
        components.host = tempURL?.host
        components.path = (tempURL?.path)!
        if components.url?.absoluteString == "https://example.com/Account/ExternalLogin" {
            let webViewtemp = WKWebView(frame: self.view.bounds, configuration: configuration)
            webViewtemp.uiDelegate = self
            webViewtemp.navigationDelegate = self
            self.view.addSubview(webViewtemp)
            return webViewtemp
        } else {
            webView.load(navigationAction.request)
        }
    }
    return nil
}

What it does is open the Apple login popup in a subView. It is not the best solution, but it should work well for now, and it worked for me. Also, don't forget to remove any AuthOrigins related to appleid authentification if you did add them. (you can see that in the Settings file)

This is a related StackOverflow post I used: https://stackoverflow.com/questions/51170722/wkwebview-popup-not-showing-up

ceisele-r commented 1 year ago

Hi @martincout , I am facing a similar issue when opening external urls. Unfortunately, the webView function with this signature gets never called (if setting a breakpoint at the start) - with or without your modifications.

Was there any other modification you made to the code in WebView.swift besides this? Thanks!

astronautulroz commented 8 months ago

Hi! Di you find a solution for this?

patrickwebvr commented 7 months ago

Is there any update or solution / work around for this? I have the same problem.

When I install the PWA on an IOS device, it is working. When I make it an IOS app then it is not working. I use for this a connection with Keycloak. So, it likes that the integration between the application and the external browser tab to login is not working.