Hi, Does the accessToken in the stsTokenManager refreshes automatically ?
If so, whats the name of the action ?
if not, whats the best practice to refresh it?
the token is expired after 60 minutes. i want to refresh it before its happened.
Thanks
I believe what you want is Firebase's getIdToken or getIdTokenResult. As mentioned in the docs passing true to getIdToken should automatically refresh it:
firebase.auth().currentUser.getIdToken()
.then((token) => {
console.log('the token is', token)
})
.catch((err) => {
console.error('Error refreshing id token', err)
})
Going to close since this is part of Firebase's JS SDK and not react-redux-firebase directly. If you have ideas around how to make this more clear, please feel free to post.
I need to have access to the latest auth token and I thought that stsTokenManager had the latest token. It would be nice to dispatch an action when the token refreshes. Something like:
firebase.auth().onIdTokenChanged.(token => dispatch({type: "tokenRefreshed", token}))
Is stsTokenManager.accessToken used for something internally?
@Wgil I don't believe it is - feel free to open a new issue to request that as a feature so we can track
Most helpful comment
I believe what you want is Firebase's getIdToken or getIdTokenResult. As mentioned in the docs passing
trueto getIdToken should automatically refresh it:Going to close since this is part of Firebase's JS SDK and not react-redux-firebase directly. If you have ideas around how to make this more clear, please feel free to post.