Problems with session usernames

Hi all,
i’m here to talking about a necessity we need. In particular we noticed that if two users have the same username (for us it is the name and surname of the user), the call logs out the first user that join the session.

It is important for us that the username is equal to the name and surname of the user because inside the call we want the name and surname displayed like in the image below.

How can we handle this situation or how can we handle any namesake situation?

Cheers Matteo

Thank you in advance

Hi Matteo,

I hope you’re doing well!

Just to clarify, the OpenVidu Call application automatically checks if a participant is already connected with the same nickname, and it prevents any new connection using a duplicate nickname.

Also, please keep in mind that OpenVidu Call is a sample default application built on top of OpenVidu. If you have a specific use case or want to customize behavior—like changing how nicknames are handled—you’ll need to modify the code accordingly. For nickname-related logic, you can take a look at the room controller

If you have any other questions or need further help, feel free to ask!

Best regards,
Carlos Santos

Hi Carlos,
I’m developing our customized web-conference and the only thing I’ve done is just assing the username of a specific user using the value of a GET parameter.
After setted up the local variable with the correct username I forced the value inside the [participantName] directive.
However I wasn’t able to reproduce what you show in the screenshot shared.
Is that something wrong with my code or maybe I forgot to use a specific directive or something else?

As you can see there’s no error for duplicates.

In this case, if I understand correctly, I need to add the duplicates control on my own, right?

Greetings, Matteo.

This is a server-side responsibility. When a token is requested for a new participant, the server should verify whether a participant with the same name is already connected. If so, it must reject the request with an appropriate error.

In fact, the call backend already handles this check. Since the frontend library has no way of knowing which participant names are currently connected, this validation must be enforced on your backend.

Greetings

Hi Carlos,

As previously mentioned, we have two different variables:

  • username → a unique identifer for each participant, used to avoid duplication
  • name_surname → contains the full name of the participant

Now the problem is that using the [participantName] variable (as you can see) is possible to force the name you want in the pre-join page of the call.

By the way we decided to avoid the possibility to choose an username adding via CSS pointer -events: none on the main field of the pre-join page.

We perform the duplicate check on the username variable specifically because, while it is uncommon, two participants may share the same name and surname. We want to ensure both can still join the call.

After that when the user clicks the “join” button and we make the token request using only the username variable, as you can see, the username on the top left corner is changed as in the screenshot below.

this.token = await this.getToken(this.sessionId, this.localParticipantUsername);

Is there a possibility to mantain the forced value (name_surname) not only in the pre-join page but also in the [participantName] variable requesting the token with another value (unique username)?

Greetings, Matteo

Hi Matteo,

Thanks for the clarification.

I’ve adjusted the participant display behavior so that the name field is now shown instead of the identity field during the call in the openvidu-components-angular library

In your backend application, you should customize which value you assign to each field based on your needs. For example, in the token generation step, you can do something like this:

const at = new AccessToken(LIVEKIT_API_KEY, LIVEKIT_API_SECRET, {
    identity: username,        // Unique identifier for the participant
    name: name_surname         // The name displayed in the UI
});

This way:

  • identity remains unique and is used for internal checks (like duplication).
  • name is what will be shown to other participants in the session (and on the UI).

Let me know if you need help adapting this to your current implementation.

Best regards,
Carlos Santos

Hi Carlos,

Thanks again for fixing it.
Could you please let me know which version of the library we need to install?

Thanks in advance!

Best regards,
Matteo

Hi Matteo,

You should install the dev version using npm i openvidu-components-angular@dev

Cheers