Fetching user's custom_id in a use session

After fetched the user account as shown in user account , the user’s custom_id is not accessible as it is not a Public Field. Is there any reason why it is so? I can get the google / Steam / Facebook IDs, etc.but just not the customer ID? Is there a way round it?

Context: I am trying to broadcast the player’s custom_id during a matchJoin call.

Thanks.

  1. Versions: Nakama {3.13.1}, {Docker}
  2. Server Framework Runtime language {TS/JS}

:tv: Media:

Hi Diety,

as you noticed custom_id is available from the Account object. Your server-side MatchJoin call can get accounts for all new users using nk.accountGetId function.

Regards,

Maxim

Please note, that custom_id is private because it can be used to authenticate to Nakama, same as device_id . You might want to add additional checks in Before hook if you decide to broadcast custom_id to all participants.

Good point! I will definitely be adding additional checks in Before hook.
So because it is a private field, is it the expected behaviour that I cannot get the custom_id from the account object?
var account: nkruntime.Account = nakama.accountGetId(presence.userId);
I can access the Steam ID via account.user.steamId
but the code would be rejected when trying to get the Custom ID via account.user.customId
Or is it just a matter of me not knowing the current name of the attribute? e.g. CustomId, customID, CustomID, custom_id, etc. ? ← I tried these already

Thanks.

@Deity The custom ID belongs to the account, not the user. See the definition here. tl;dr is account.customId is what you’re looking for.