Firebase authentication tokens expiration duration

醉酒当歌 提交于 2019-12-06 06:27:19

问题


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?


回答1:


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




回答2:


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 });


来源:https://stackoverflow.com/questions/37913470/firebase-authentication-tokens-expiration-duration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!