Google Login: Unable to disable iOS app

I applied google SignIn in my iOS app and for the first time I can log in to my google account. But when I log out and try to log in, I get the account permission screen as shown below with the last user, not the SignIn screen.

enter image description here

Below is the code I used.

var signIn = GIDSignIn.sharedInstance()
signIn.delegate = self
signIn.uiDelegate = self

Below is the code to exit and disable

GIDSignIn.sharedInstance().signOut()
GIDSignIn.sharedInstance().disconnect()

After disconnecting, I try again to log in using the code below

GIDSignIn.sharedInstance().signIn()

How can I display the login screen after checkout and shutdown?

+4
source share
1 answer

I got stuck on this for a while, and I came up with a pretty hacky solution.

, GIDSignIn - Safari, cookie/ IOS Keychain ( OAuth).

, SFSafariViewController :

import SafariServices

class MyViewController: SFSafariViewControllerDelegate {
...

( ):

let logoutUrl = URL(string: "https://www.google.com/accounts/Logout")!
let logoutViewController = SFSafariViewController.init(url: logoutUrl)
logoutViewController.delegate = self
self.present(logoutViewController, animated: true, completion: nil)

didCompleteInitialLoad :

func safariViewController(_ controller: SFSafariViewController, didCompleteInitialLoad didLoadSuccessfully: Bool) {
    controller.dismiss(animated: false) {
        //Switch view controllers
    }
}

, .

+1

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


All Articles