'How to get the refresh token from Firebase.auth.currentUser Android Kotlin

I am breaking my head on how to get the refresh token from FirebaseAuth but cannot seem to find how.

On iOS, the equivalent is Auth.auth().currentUser?.refreshToken. Any help is highly appreciated.



Solution 1:[1]

firebaseUser. getIdToken() reloads your token

Solution 2:[2]

Read this answer https://stackoverflow.com/a/45427901/6534576

Maybe you solution is use the getIdToken listener.

  • getIdToken(true) only if you want refresh the token

  • getIdToken(false) if you only want get the current

code

user.getIdToken(true).addOnSuccessListener { result ->
      val token = result.token
}

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Furkan ?enocak
Solution 2 vibroto