4

I am working on Firebase and I have one query. I have login through Firebase and have fired insert, update, delete queries.

Here is my code:

[self.data observeEventType:FIRDataEventTypeChildAdded withBlock:^(FIRDataSnapshot * _Nonnull snapshot) {
        NSArray *array = snapshot.value;
        NSLog(@"%@",array);
    }];

This block works perfectly but after every 24 hours it stops calling. However, if I update pod then again it starts working.

Adam B
  • 3,775
  • 3
  • 32
  • 42
Anjali Bhimani
  • 787
  • 5
  • 17

1 Answers1

3

Based on new Firebase there is no option to manage session like old so you just need to call sign Out API if your session expired:

NSError *error;
[[FIRAuth auth] signOut:&error];
if (!error) {
  // Sign-out succeeded
}

And force to user signIn again so there is no need to install firebase pod again.


If you are old Firebase user then manage it by following:

If you check the Firebase Persisting User Auth State

When a user authenticates, the default session length is 24 hours from initial authentication. This means that the user's authentication state will automatically be persisted between page loads. You can configure the session length by navigating to the Login & Auth section of your Firebase App Dashboard and configuring the Session Length dropdown on the top right. Every auth provider has an optional remember parameter.

So Tokens issued to the authenticated users are valid for 24 hours by default. You can change this from the Login & Auth tab on the App Dashboard.

Community
  • 1
  • 1
Nitin Gohel
  • 49,482
  • 17
  • 105
  • 144
  • In new firebase dashboard there is no such tab....so i am not able to change session length – Anjali Bhimani Jun 17 '16 at 10:15
  • if you are migrate your old app to new there is no session maintain option that will be managed automatically check : http://stackoverflow.com/questions/37346251/firebase-session-length-new-console and http://stackoverflow.com/questions/37487283/firebase-3-x-token-session-expiration – Nitin Gohel Jun 17 '16 at 10:19
  • you also can identifier : FIRAuthErrorCodeUserTokenExpired : https://firebase.google.com/docs/auth/ios/errors – Nitin Gohel Jun 17 '16 at 10:36
  • join us on chat : http://chat.stackoverflow.com/rooms/15038/ios-developer-family : lots of dev hoi :D – Nitin Gohel Jun 17 '16 at 10:40