Set Room Password Problem

Hi everyone!! I’m using the Jitsi Meet API with ‘meet.jit.si’ domain.
I’m setting the password when the room is created, but when the other user try enter in the room this error ocurre. I’m using the API for both users.
CONFERENCE FAILED: conference.passwordRequired

This error ocurre before passwordRequired event

You can use this

api.addEventListener(“passwordRequired”, () => {
api.executeCommand(“password”, password);
});

how to set password after joining call? can you share me some code snippet? I am new in react.
Thanks

Where does that go exactly in React?
Im using react-jitsi component

I have already set this.
But sometimes that is working and sometimes that is not working
image

Here is my code

api.addEventListener(‘participantRoleChanged’, function (event) {

    if (event.role === "moderator") {

        api.executeCommand('password', password);

    }

}); 


api.on('passwordRequired', function () {      

    setTimeout(function () {

        password.executeCommand('password', password);

    }, 200)

});

api.on('videoConferenceJoined', (response) => {

    setTimeout(function () {

        api.executeCommand('password', password);

    }, 200)

});

But sometimes that is work and in many cases that is not working
How can I resolve this issue?