runCatchingRecentLoginException

suspend fun FirebaseUser.runCatchingRecentLoginException(password: String, updateBlock: suspend () -> Unit)

A utility function that executes the given updateBlock and tries to re-run the block if the updateBlock throws a FirebaseAuthRecentLoginRequiredException. If the block throws any other exception, it will be re-thrown.

This is mainly meant to be used with FirebaseUser's update functions such as FirebaseUser.updateEmail and FirebaseUser.updatePassword which throw an instance of FirebaseAuthRecentLoginRequiredException if the user has not logged-in recently. If such an exception is thrown, the update block will be called again after re-authenticating the user using the FirebaseUser.reauthenticate method.

Parameters

password

the password to use in the FirebaseUser.reauthenticate method.