How to make sure ComponentData on inital connection entity exists when the connected event is fired?

Initial Client Connection Code:

m_ClientNetworkIdQuery = m_clientWorld.EntityManager.CreateEntityQuery(ComponentType.ReadOnly<NetworkId>());
    var clientConnectionRequestEntity = m_clientWorld.EntityManager.CreateEntity();
    m_clientWorld.EntityManager.AddComponentData(clientConnectionRequestEntity, get_client_credentials());
    using var networkDriverQuery = m_clientWorld.EntityManager.CreateEntityQuery(ComponentType.ReadWrite<NetworkStreamDriver>());
    networkDriverQuery.GetSingletonRW<NetworkStreamDriver>().ValueRW.Connect(m_clientWorld.EntityManager, connectionEndPoint, clientConnectionRequestEntity);

Server Side connected event checking:

public void OnUpdate(ref SystemState state)
  {
    var ecb = new EntityCommandBuffer(Allocator.Temp);
    foreach (var evt in SystemAPI.GetSingleton<NetworkStreamDriver>().ConnectionEventsForTick) {      
      Entity connectedEntity = evt.ConnectionEntity;
      bool hasClientLoginCreds = SystemAPI.HasComponent<ClientLoginCredentials>(connectedEntity);
      Debug.Log($"hasclientlogincreds:{hasClientLoginCreds} ConnectionState: {evt.State.ToFixedString()}");
  }
ecb.Playback(state.EntityManager);
}

ClientLoginCredentials is an IComponentData that is also returned by get_client_credentials.
The server log when the event is Connected however indicates that ‘hasClientLoginCreds’ is false.

Note that I can (and do) pass the info directly after the fact via a client system that adds the same data as an RPC/SendRpcCommandRequest pair and a server system that receives it, but it doesn’t receive it until after the server side connection event has already fired, making the connection event not useful for client credential checking and identification.

I’d prefer to simplify things by passing all relevant client info directly into the connect function (or the entity sent to the connect function) and to be able to reliably retrieve it when the connected event fires as in the above code so I can decide then and there if the credentials pass or to drop the connection, rather than having to do it as a separate step afterward.

How can I do that?

Netcode 1.3 adds a new connection approval flow, that just released last week. That seems like the perfect use case for this.

how do I download it to try it out? It does not appear by direct search or seem to be available in the package manager despite having enable pre-release packages turned on.

You need to add the package by name by clicking the + in the top left:

Name: com.unity.netcode
Version: 1.3.0-exp.1

Did not work…
9898179--1429410--upload_2024-6-19_9-45-46.png9898179--1429413--upload_2024-6-19_9-47-11.png

We should have a fix for this out soon. Try using 2.2.1 in the meantime.