'Firebase auth : getIdTokenResult(true) returns expired token after few minutes of inactivity

Using Firebase auth from https://github.com/invertase/react-native-firebase for the react-native project. It works well in all scenarios, handling the token renewal and auth state changes. But when I keep the app open for sometime , and do nothing , or just minimise and come back to the app after 30 mins or 1 hour of inactivity, the

firebase
    .auth()
    .currentUser?.getIdTokenResult(true)

returns an expired token ( probably it's not refreshing it when i request.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source