khmyznikov / ios-pwa-wrap

Makes possible of publishing PWA to Apple Store like TWA from Google.
The Unlicense
160 stars 14 forks source link

403 on fetching script for Google Sign in button #3

Closed aidar87 closed 2 years ago

aidar87 commented 2 years ago

Hi, thanks, I like your pwa wrapper, I added sign in with Google account, in Safari all is ok, but in wrapper I got 403 error when fetching js script https://accounts.google.com/gsi/client. Not sure, maybe app should be added somewhere in google cloud console or install Pod for google or creating separate OAuth sign in credentianl in Google Console

khmyznikov commented 2 years ago

@aidar87 login is limited by the redirect approach. You shouldn't get any error by fetching js. Maybe you need to add google domains to info.plist. What exactly error do you get?

aidar87 commented 2 years ago

Tried to add accounts.google.com to in app bounded domain to Info.plist, to authOrigins in Settings.swift but it didn' help. Here are screenshots from pwa-wrap with errors: 403headers 403console

And here is screenshot where it works on iOS safari: success

khmyznikov commented 2 years ago

Try to debug this function and see what happens with this request.

aidar87 commented 2 years ago

webView function was not called on this request.

khmyznikov commented 2 years ago

Do you use HTTPS? Have you tried this on a real device? How do you plug in this gsi?

aidar87 commented 2 years ago

Sure, https, the referer header in screenshots are the same. I tried on real iphone XR ios 15.3.1 - from safari script is loaded successfully, from pwa app which is published to App Store get 403 error. I tried to add script tag in html, appending using js both got 403 from google server.

Can I replace user-agent in pwa-wrapper webview? Asking because safari user-agent differs from webview's

khmyznikov commented 2 years ago

Can I replace user-agent in pwa-wrapper webview? Asking because safari user-agent differs from webview's

Yeah of course https://github.com/khmyznikov/ios-pwa-wrap/blob/f01a2600ba62b093187f1507a8ee2533fe4afbfe/pwa-shell/WebView.swift#L51

aidar87 commented 2 years ago

Thank you very much, with custom UserAgent it works!

khmyznikov commented 2 years ago

Thank you very much, with custom UserAgent it works!

Do you used this string? Or added something extra?

aidar87 commented 2 years ago

Yes, I did. I am using your previous project before you added this feature with custom user agent

dmytro-podolianskyi-ew commented 2 years ago

@aidar87 Could you tell for more details on what did you do for google social login. I have the issue when you choose the user and then I stuck on the consent screen and that's all. I used debug for check - but all is ok. Errors are absent. In the browser all is ok.

keysen1 commented 2 years ago

@dmytro-podolianskyi-ew I have exactly the same issue, have you found a solution?

aidar87 commented 2 years ago

Guys, sorry for the late answer. It is working. Here is workaround: I used redirect for Google OAuth, pop up didn't work. Added accounts.google.com to the Info.plist and authOrigins variables in Settings.swift, changed webView.customUserAgent to any different.

saintego commented 1 year ago

@keysen1 @dmytro-podolianskyi-ew did you find any solution for consent screen? I have same issue and @aidar87 solution is not enough. I sign by google, login by google, end up with 400 on consent https://accounts.google.com/signin/oauth/consent?... When I try login by google again, there is already session and it works