私のアプリにはGoogleでログインするオプションがあります。 Googleが提供するボタンをクリックすると、Webビューが開き、ユーザーは自分の資格情報を入力します。アプリケーションが情報にアクセスできるようにした後、アプリはSignInViewControllerを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)")
}
}
cは、あなたが(GIDSignIn.sharedInstanceを試してみましたが) .signOut() –
ありがとうございました! – About7Deaths
あなたは歓迎です –