इसलिए मेरे ऐप में Google के साथ साइन इन करने का विकल्प है। Google द्वारा प्रदान किए जाने वाले बटन पर क्लिक करने पर, एक वेब दृश्य खुलता है और उपयोगकर्ता को उनके प्रमाण-पत्र इनपुट होते हैं। ऐप को उनकी जानकारी तक पहुंचने की अनुमति देने के बाद ऐप उपयोगकर्ता को साइन इन करता है और साइनब्यू कंट्रोलर को TabBarController में बदलता है (जहां वे अब तदनुसार बातचीत कर सकते हैं)।प्रमाणीकृत होने के बाद Google से साइन आउट कैसे करें
जब उपयोगकर्ता साइनआउट बटन दबाता है तो उन्हें लॉगिन स्क्रीन पर निर्देशित किया जाता है जैसा कि कोई उम्मीद करेगा। लेकिन अजीब चीज यह है कि यदि उपयोगकर्ता फिर से Google बटन दबाता है तो वे स्वचालित रूप से किसी भी प्रमाणीकरण के साथ साइन इन नहीं होते हैं और उनके खाते को हटाने का कोई विकल्प नहीं है। क्या उपयोगकर्ताओं को आकस्मिक चोरी से बचाने के लिए Google खाता प्रमाण-पत्रों को साफ़ करने का उनका तरीका है?
समारोह मेंसाइन इन करें:
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)
}
// ...
}
साइन आउट समारोह:
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)")
}
}
आप GIDSignIn.sharedInstance की कोशिश की है() .signOut() –
धन्यवाद, यह काम किया! – About7Deaths
आपका स्वागत है –