0

I want to do sign out from my application after i signing in with firebase, and i tried this code in my application but it not working.

print("clickSignOut")
        do {
            try Auth.auth().signOut()
       } catch {
         print("can't signOut")strong text
       }
      print(Auth.auth().currentUser ?? "no user")
  • The Firebase auth session is stored in the users keychain which is why it looks like they are still authenticated with the print statement. You need to manually remove that keychain data using the technique in the linked question. See [this answer](https://stackoverflow.com/questions/39301815/firebase-ios-swift-firauth-auth-signout-not-signing-out-current-user#answer-40412452) for some code suggestions as well. – Jay Nov 11 '19 at 20:40

2 Answers2

1

This always works for me:

do {
    try Auth.auth().signOut()
} catch let error {
    print("Error: ", error.localizedDescription)
}

If this isn't working for you, provide us with some more context. What do you mean by "it's not working"? If you use this code provided, it will tell what error you're encountering.

David Chopin
  • 2,780
  • 2
  • 19
  • 40
0

Check if this helps:

try! Auth.auth().signOut()
Parth
  • 2,682
  • 1
  • 20
  • 39