but later in the flow I need to fetch a fresh idtoken since I need the post login action to rerun and populate token with some newly added app_metadata value (which happens after first login+ backend call). Is there anyway to fetch a freshly minted idtoken by re invoking getIdTokenClaims or do I need to logout and back in?
Also is an alternative to make an api call instead, to auth0, since I just need to get some app_metadata from the user record, that has been updated after first login attempt.
This should be possible by calling getAccessTokenSilently and passing the cacheMode param{cacheMode: "off"}. This basically just forces the refreshing of tokens - Unfortunately I am not aware of any way to only get a new ID token, so this will also return a new access token.
if I get a new idToken like this and the token claims have exp field in them, can I use them to decide if I need to get a new idToken? Or does the exp only apply to access tokens?
I am wondering I would beset handle expired idTokens in my app, I am using the idToken in my backend to extract app-metadata