Google Plus iOS API - Sharing or Logging in Without Switching to Safari

So far, everything that I have found on this issue is NOT.

My application works great when a user logs in and exchanges data, but both actions require a mobile safari, which is less ideal for the user, someone has found a way to either post a message or log in to Google + using UIWebView or GET / POST ?

Any help would be greatly appreciated.

Thanks.

+4
source share
3 answers

You can log in via Google+ to UIWebView.

GTMOAuth2ViewControllerTouch *_googlePlusCtrl = [[GTMOAuth2ViewControllerTouch alloc] initWithScope:@"https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/plus.me" clientID:GOOGLE_PLUS_CLIENT_ID clientSecret:GOOGLE_PLUS_CLIENT_SECRET keychainItemName:@"GooglePlus_Sample_App" delegate:self finishedSelector:@selector(viewController:finishedWithAuth:error:)]; 

Hope this helps you.

+5
source

The simplest answer is no, as you say. The SDK will actually try to return to the following:

  • Log in to the Google+ app (this is a good result, but requires a Google+ app).
  • Sign in with Chrome
  • Sign in with Mobile Safari

You can control the first part using the trySSO flag of the GPPSignIn object - if you set it to NO, it will not try to use the Google+ application. Usually you need to try the Google+ app first. Sharing is always done via the web interface (chrome / safari) with the current version of the API (1.2.1).

+6
source

Good thing. Maybe. The first step is to download a sample project from here - https://github.com/emysa341/Login-with-gmail-google-g--using-oath-2.0-protocol . The second step, in the response connection, completed the download, made another request - https://www.googleapis.com/oauth2/v1/userinfo?access_token=%@ . Use the access token received from the first request. Now in the response you will receive user data. Also, if you need a user's email, change the scope to " https://www.googleapis.com/auth/userinfo.email ".

+2
source

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


All Articles