4

I just upgraded to the new version of Firebase and I can't find where I can set the expiration duration of my Firebase authentication tokens. It used to be under the authentication section in Firebase's old layout (I had it set for 1 year). Does Firebase still have this?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Holger Sindbaek
  • 2,278
  • 6
  • 41
  • 68

2 Answers2

5

If you keep using the Firebase 2.x SDK, your expiration period will be the same as before. You cannot change the value anymore though.

If you upgrade your code to use the 3.x SDK, it'll switch to user a never-expiring ID token and a quickly expiring access token. See this answer for more on that: Firebase authentication duration is too persistent

Community
  • 1
  • 1
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
0

I am able to login to firebase using below code:

this.firebaseAuth
        .auth.signInWithCustomToken(this.token)
        .then(value => {
           var that=this;
           firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idToken) {
//get authorization token idToken here
}

I am able to to query firebase after login, but after refresh firebase not able to recognise the user?

I have stored token in localstorage but how to set token in angular firebase request? for below code:

this.afs.doc(
        `user/${user.uid}`
    ).set(Object.assign({}, auser), { merge: true });
Shruti
  • 75
  • 10