authenticateCustom username ingored

Hi. I use client.authenticateCustom auth from client side and pass userId and username params to method. But I didn’t see passed username inside nakama panel and inside Presence object on server (username that I see is random generated string).
I investigating a problem and see next:

  • I added hook “before custom auth”
  • do custom auth from client
  • logging request and I see correct user id and username:

nakama_1 | {“msg”:“id: 5695f0f2-b581-4c92-8e32-1c9c7cc4400f”,“api_id”:“authenticatecustom”,“mode”:“after”}
nakama_1 | {“msg”:“username: 5695f0f2-b581-4c92-8e32-1c9c7cc4400f”,“api_id”:“authenticatecustom”,“mode”:“after”}

  • logging Presence from streamUserList:

nakama_1 | {“msg”:“id f332ffc6-759a-403e-a900-22bc233dfdb4”,“rpc_id”:“get_friends_online”}
nakama_1 | {“msg”:“username uwLHRTaCNV”,“rpc_id”:“get_friends_online”}

So I see that passed userId and username to custom auth ignored at some step after auth.
Can anyone take a look please?




@kutsme I’ve just tested this on Nakama 3.11.0 and authenticate custom, that exact before hook in JS, and the devconsole all reflect the username that’s been passed in.

Can you share your exact Nakama version? Perhaps it’s an issue that has already been fixed.

@kutsme It’s worth noting that the username passed to the authenticate call is only ever used when the account is first created. Authenticate custom cannot change the username of a previously created account.

If you’re trying to change the username of an existing account you should use the account update operation, then refresh the user’s session.

Thanks for your help. I figured out it by updating user accounts.