I\'m using the following code, to detect auth provider and log out properly
static func logOut() {
let auth = FIRAuth.auth()!
let provider = auth.cur
Swift 4 solution:
if let providerData = Auth.auth().currentUser?.providerData {
for userInfo in providerData {
switch userInfo.providerID {
case "facebook.com":
print("user is signed in with facebook")
case "google.com":
print("user is signed in with google")
default:
print("user is signed in with \(userInfo.providerID)")
}
}
}