api.UpdateAccountRequest have no property for UserId?

Currently, I want to set Username for players, I want the username in nakama to be the same as usernames in my server. Because Nakama does not allow 2 players to have the same username so I have to delete the old account having the designed username if there is any first.
I’m working with “BeforeUpdateAccount” function. However, the api.UpdateAccountRequest does not have the userId value of the current player, so cannot check the current player is the one having the designed username or not.

Hope someone can suggest me what should I do in this case.

Hi I’m not sure If I understand correctly becuase, as you say, Nakama requires usernames to be unique so it won’t allow another user to use an already registered username. On the otherhand if a user is already registered why would you want to delete them if someone tries to take their username: the standard way of doing this is to tell the user something like ‘sorry, this username is already taken’ and require them to change it.