简体   繁体   中英

How to get firebase last auth token Refresh time

I want to get when did the token refreshed last time from firebase. How can I get that?

I have refered answer based on this post. But did not understand properly please help

If you are using Javascript SDK you can use getIdTokenResult method and check for issuedAtTime . It is defined as "The ID token issued at time formatted as a UTC string." in the documentation .

const user = firebase.auth().currentUser

if (user) {
  user.getIdTokenResult().then((result) => {
    const {issuedAtTime, expirationTime} = result 
    console.log(`This token was issued at: ${issuedAtTime}`)
    console.log(`This token will expire at: ${expirationTime}`)
  })
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM