You can also create new password-authenticated users from the Authentication
section of the Firebase console, on the Users page.

Get the currently signed-in user

The recommended way to get the current user is by calling the getCurrentUser method.
If no user is signed in, getCurrentUser returns null:

Java

FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {
// User is signed in
} else {
// No user is signed in
}

Kotlin

val user = FirebaseAuth.getInstance().currentUser
if (user != null) {
// User is signed in
} else {
// No user is signed in
}

There are some cases where getCurrentUser will return a non-null FirebaseUser
but the underlying token is not valid. This can happen, for example, if the user
was deleted on another device and the local token has not refreshed. In this case,
you may get a valid user getCurrentUser but subsequent calls to authenticated
resources will fail.

getCurrentUser might also return null because the auth object has not
finished initializing.

If you attach an AuthStateListener
you will get a callback every time the underlying token state changes. This can
be useful to react to edge cases like those mentioned above.

Get a user's profile

To get a user's profile information, use the accessor methods of an instance of
FirebaseUser. For example: