Comment se déconnecter de Google Après avoir été Authentifié

Donc mon application a la possibilité de vous connecter avec Google. En cliquant sur le bouton que Google fournit un affichage web s'ouvre et a l'utilisateur de saisir ses informations d'identification. Après avoir autorisé l'application à accéder à leurs informations de l'application, puis des signes de l'utilisateur et de modifier la SignInViewController à la TabBarController (où ils peuvent interagir en conséquence).

Lorsque l'utilisateur appuie sur un Signout bouton, ils sont dirigés vers l'écran de connexion que l'on pourrait attendre. Mais la chose étrange est, si l'utilisateur appuie sur le bouton google plus, ils sont automatiquement connecté avec aucune autre authentification à tous et pas d'option pour supprimer leur compte. Est-ce pour effacer les identifiants de compte google à protéger les utilisateurs contre le vol?

Signe en fonction:

func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!, withError error: NSError!) {
    if let error = error {
        print(error.localizedDescription)
        return
    }
    let authentication = user.authentication
    let credential = FIRGoogleAuthProvider.credentialWithIDToken(authentication.idToken, accessToken: authentication.accessToken)
    FIRAuth.auth()?.signInWithCredential(credential) { (user, error) in
        //...
        SignInViewController().signedIn(user)
    }
    //...
}

De signe de la fonction:

func signOutOverride() {
    do {
        try! FIRAuth.auth()!.signOut()
        CredentialState.sharedInstance.signedIn = false
        //Set the view to the login screen after signing out
        let storyboard = UIStoryboard(name: "SignIn", bundle: nil)
        let loginVC = storyboard.instantiateViewControllerWithIdentifier("SignInVC") as! SignInViewController
        let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
        appDelegate.window?.rootViewController = loginVC
    } catch let signOutError as NSError {
        print ("Error signing out: \(signOutError)")
    }
}
  • avez-vous essayé GIDSignIn.sharedInstance().signOut()
  • Merci, cela a fonctionné!
  • Vous êtes les bienvenus
InformationsquelleAutor About7Deaths | 2016-06-21