New token for every page refresh? #200
Answered
by
kmjennison
andrewli-ca
asked this question in
Q&A
-
Hi there, I'm just wondering is it the expected behavior for a new token to be returned each time a page is refreshed? export const getServerSideProps = withAuthUserTokenSSR({
whenUnauthed: AuthAction.REDIRECT_TO_LOGIN,
})(async ({ AuthUser, req }) => {
const token = await AuthUser.getIdToken()
console.log(token) // New token each request
return {
props: { },
}
})
export default withAuthUser({
whenUnauthedAfterInit: AuthAction.REDIRECT_TO_LOGIN,
})(Demo) |
Beta Was this translation helpful? Give feedback.
Answered by
kmjennison
Jun 10, 2021
Replies: 1 comment 3 replies
-
Yes, it's expected. The auth cookies are set whenever the Firebase client's ID token changes, which is typically at least once per app load. When that happens, the "issued at" and "expiration" timestamps change in the token, and so the next |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
andrewli-ca
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, it's expected. The auth cookies are set whenever the Firebase client's ID token changes, which is typically at least once per app load. When that happens, the "issued at" and "expiration" timestamps change in the token, and so the next
withAuthUserTokenSSR
will see a new token.