How to fix Google Login / Registration violations on WKWebView?

A few weeks ago I asked a question that I thought would solve the problem with Google Login / Registration, but it is still broken.

  • Open getpocket.com
  • Click Sign In>
  • Click "Sign in to Google"

When you enter your email address and password, and then click the button, the page will become blank and nothing will happen. No redirection, no download, nothing.

Safari redirects and logs a page successfully.

I tried google login using stackoverflow.com and it works!

But I believe that he uses a different method, because he does not ask me about anything, the login just happens. He doesn’t even ask me to choose which account I want to log in with. Everything happens automatically.

Usually, if you enter your email address and password, Google will ask you to choose which account you want to use to log in without having to enter the information again.

With getpocket.com this screen appears, I click on my account and it freezes. The orange animation of the loading drum plays endlessly.

I do not understand what the problem is.

Could this be a user agent?

Any ideas?

Initializing WKWebView is very simple:

_webView = [[WKWebView alloc] init]; _webView.allowsBackForwardNavigationGestures = NO; _webView.allowsLinkPreview = NO; _webView.navigationDelegate = self; _webView.UIDelegate = self; _webView.frame = CGRectMake(0.0, 0.0, self.contentView.frame.size.width, self.contentView.frame.size.height); [self.contentView addSubview:_webView]; 

I even tried the popular iCab Web Browser and the problem still exists with getpocket.com

+5
source share
2 answers

Here are a few studies that I have collected:

1) https://www.whatismybrowser.com/developers/tools/user-agent-parser/browse/browser-name/icab-user-agents - the latest iCab has an iCab user agent.

2) https://en.wikipedia.org/wiki/User_agent#User_agent_spoofing - iCab has a "user agent spoofing" function. When you request oAuth2.0, your oAuth request is controlled by the Google Play service. If the Google Play Service does not have an iCab user agent, Google Play uses the default user agent and, ultimately, from the server, your iCab browser receives an HTML page redirect page. During this time, iCab coincides with the user agent again. Here, iCab finds another user agent, so it blocks page loading.

I checked from Chrome, everything was up and running. Thus, perhaps this should be a problem due to the user agent.

https://udger.com/resources/ua-list - On this site I read that iCab uses the webkit user agent.

I'm definitely not sure, but there are great chances due to user agents spoofing , this creates a problem.

0
source

Google’s announcement is clear: “In the coming months, we won’t allow OAuth requests for Google longer in embedded browsers known as web views, such as the WebView UI element on Android and the UIWebView / WKWebView on iOS and the equivalents on Windows and OS X . "

src: theregister.co.uk

0
source

Source: https://habr.com/ru/post/1269871/


All Articles