Google Signin: Unable to Disconnect iOS App

iOS Rejection due to Google SignIn. Latest Google SignIn (4.0.0) goes to safari

Finally I managed to make changes and get it aprooved by downgrading to GoogleSignIn 3.0.0 which has
allowsSignInWithBrowser and allowsSignInWithWebView properties
Which I make use of with

allowsSignInWithBrowser = NO
allowsSignInWithWebView = YES

Had to change the pod file to this in order to make everything build (having google analytics too made the thing so much difficult, cause of dependecies).

Hope Google Engineers update the SignIn 4.0.0, because I don't like having old libraries, but I can't have my app rejected until Google Changes the libs

pod 'Google/Analytics'

pod 'GoogleSignIn', '3.0.0'
pod 'Google/SignIn'
pod 'Google', '2.0.4'
pod 'GoogleAppUtilities'
pod 'GoogleAuthUtilities'
pod 'GoogleNetworkingUtilities'

Good luck to you guys too,
Thanks Paulw11, he made a test project and saw the same problem in iOS8.
also, telling reviewers that other (even big) apps in App Store are usign webview even if iOS9, not only iOS8, did not help, because they said this cannot be a reason for other apps to be, and they are working hard to reject other too.

If Any changes made, for example a new GoogleSignIn library, please make a new answer!

How to Sign Out of Google After Being Authenticated

Swift

try GIDSignIn.sharedInstance().signOut()

objective - c

[[GIDSignIn sharedInstance] signOut];

Logging out with Google OAuth on iOS

In the end the only thing that does what I need is to load Google's "logout" page, as described in another answer. Basically, load https://www.google.com/accounts/Logout.

I had thought that the approach would be to revoke the app's OAuth tokens, but that's not actually what I need. I can revoke them, but Google will then issue another one without requiring a password (or it might be the same key-- it doesn't really matter to me if no password is required). I gather that this is based on browser cookies, but since I'm using SFSafariViewController on iOS I can't inspect the cookies. Revocation is a waste of time if tokens will be reissued like this.

Loading the logout page seems like kind of a hack but it has the useful effect of clearing out whatever browser state allows resuming access without requiring a password from the user.

On iOS this could produce an annoying UI artifact of displaying a web view when the user didn't expect one. But it's easy to prevent that by presenting the SFSafariViewController in a way that keeps the web view hidden. I did it like this, but there are other approaches.

func logout(presentingViewController:UIViewController?) -> Void {
guard let presentingViewController = presentingViewController else {
fatalError("A presenting view controller is required")
}

let logoutUrl = URL(string: "https://www.google.com/accounts/Logout")!
let logoutVC = SFSafariViewController(url: logoutUrl)
logoutVC.delegate = self

presentingViewController.addChildViewController(logoutVC)
presentingViewController.view.addSubview(logoutVC.view)
presentingViewController.view.sendSubview(toBack: logoutVC.view)
logoutVC.didMove(toParentViewController: presentingViewController)

// Remove our OAuth token
self.authorization = nil
}

The delegate assignment is important. In the delegate, I implemented this to dismiss the SFSafariViewController as soon as the logout page loads:

func safariViewController(_ controller: SFSafariViewController, didCompleteInitialLoad didLoadSuccessfully: Bool) {
controller.didMove(toParentViewController: nil)
controller.view.removeFromSuperview()
controller.removeFromParentViewController()
}


Related Topics



Leave a reply



Submit