I have used \"signInWithCustomToken()\" to authenticate firebase user.
This token expires in 1 hour.
Firebase has recommended tok
Something like this is a way to check the Token and see if its expired. You can then mint a new one
public async Task GetIdTokenAsync()
{
// Get current time in seconds from Epoch
var secondsSinceEpoch = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
// We have already minted a token for this session, so check if we need a new one
if (this.idToken != null)
{
// Check to see if current token is expired or will expire soon
var idTokenExpiration = JwtDecoder.TokenExpirationTime(this.idToken);
if (idTokenExpiration > (secondsSinceEpoch - 60L))
{
return this.idToken;
}
}
// No id token for this session, or we have an id token, but its expired, so mint a new one
this.idToken = await auth?.CurrentUser?.GetIdTokenAsync(true);
return this.idToken;
}