How do you log out of Firebase? (Objective C)

时间:2016-04-04 18:47:20

标签: ios objective-c firebase firebase-authentication

I'm trying to log out users from my app. In the Firebase API, it says to use [ref unauth];

What exactly is the ref that I'm supposed to unauthorize? Is it a Firebase reference or the user's uid? I've used a Firebase reference, and it doesn't seem to do anything. How do I use this command? What exactly is it supposed to do? I haven't come across a good example.

2 个答案:

答案 0 :(得分:4)

NSError *signOutError;
BOOL status = [[FIRAuth auth] signOut:&signOutError];
if (!status) {
    NSLog(@"Error signing out: %@", signOutError);
    return;
}else{
    NSLog(@"Successfully Signout");
}

实施此代码,您必须享受它适用于退出。 提前致谢。享受。

答案 1 :(得分:2)

The Firebase client manages the connection to its servers behind the scenes and authenticates on that connection instead of per Firebase object. This means that whenever you call for example ref authUser:@"jenny@example.com" password:@"correcthorsebatterystaple" on any Firebase reference, the user is authenticated on all references.

Similarly: when you call unauth on any Firebase reference, the user will be signed out of all references in your app.