So, I am creating a simple registration - login screen app, for android, using Kotlin and Firebase. The user should be able to register, by providing his email address, a username and a password. If the email and username are not being used already, the user should be able to login, using his username and password
The problem I am facing is, I cannot understand how to save the username and use it for authentication. I thought of using the createUserWithEmailAndPassword function as shown below.
suspend fun registerUser(email: String, password: String) {
response = MutableLiveData()
try {
auth.createUserWithEmailAndPassword(email, password).await()
response.value = "Succeed"
} catch (e: Exception) {
response.value = e.message
}
}
If the user manages to register, I'll then use the currentUser function, to save his username
Thing is, I am stuck on where to go from there (if that is even the way to go). The documentation did not help all that much, so any detailed answer would help
Thanks