How to link Firebase's Authentication to Realtime Database?

From the code you are writing I expect you are using react-native-firebase? If not - you should use it :-)

Solution for react-native-firebase:

As soon as you are registered or logged in you can use the firebase.auth().currentUser Object. This object includes a uid (currentUser.uid). You can then push some data to the database under the uid with something like firebase.database().ref('users/' + firebase.auth().currentUser.uid + "/profile").set(); For example in your register like this:

    register () {
        const validate = this.refs.form.getValue();
        if(this.validate) {
            const errorHandler = ((e)=>{
            console.log(e);
            if(e.code == 'auth/email-already-in-use'){
                Toast.show({ text: `${Strings.ST36}`, position: 'bottom', buttonText: `${Strings.ST33}` })
            } else {
                Toast.show({ text: `${Strings.ST32}`, position: 'bottom', buttonText: `${Strings.ST33}` })
            }
        })
        firebase.auth().createUserWithEmailAndPassword(validate.email,validate.password).then((response) => {
            firebase.auth().currentUser.updateProfile({
                displayName : validate.name,
            }).then(()=>{
                firebase.database().ref('users/' + firebase.auth().currentUser.uid + "/profile").set(firebase.auth().currentUser);
            }).catch(errorHandler);
        }).catch(errorHandler)
    }}

Security:

I do not recommend to set the whole user data in your database, since you do not need it there. Use the database to save user progress or something similar.

Security 2:

You should set the security rules of your database, that only the user can read and write in his db node. Use something like:

{
    "rules": {
        ".read": false,
        ".write": false,
        "users":
        {
            "$userId":
            {
                ".read": "auth.uid === $userId",
                ".write": "auth.uid === $userId"
            }
        }
    }
}

Edit 1: Please try to remove push since it generates a unique key, which has nothing to do with the user. It will be hard to find your user data again. And do not use set twice since it won't work. enter image description here

Edit 2: You have to set the nodes you want to be readable/writable to true like this:

{
    "rules": {
        ".read": false,
        ".write": false,
        "users":
        {
            "$userId":
            {
                ".read": "auth.uid === $userId",
                ".write": "auth.uid === $userId"
            }
        },
        // readable node
        "messages":
        {
            ".read": true
        },
        // readable and writable node
        "messages":
        {
            ".read": true,
            ".write": true
        }
    }
}