You can do this with the help of Match Making. Below is the link for the same
You can create a room property say "isValidUser" and set its value to "true".
Then you can authenticate the user on the client side and if user is a valid user, you can allow him to join the room by calling the joinRoomWithProperties by passing the Property as IsValidUser and value to true.
Another way to achieve it is that the first user who creates/join the room can set a property say "password" and set some value for the password. After that he can send a private chat in which he will send the password value to the user whom he wants to play with. Then the another user can call joinRoomWithProperties whose password value is the same that he has recieved in private chat.
Please let me know in case of any issues.