Quick answer: Server: set_auth_callback. Client: send_auth before peer_connected. Both sides handle peer_authenticating.
Connection drops with auth error. Server expects token; client sends none. Mismatch.
The Fix
# Server
multiplayer.peer_authenticating.connect(func(id):
# wait for client send_auth, validate
multiplayer.complete_auth(id)
)
# Client
multiplayer.peer_authenticating.connect(func(id):
multiplayer.send_auth(id, "mytoken".to_utf8_buffer())
multiplayer.complete_auth(id)
)
Symmetric handlers + complete_auth on both sides finishes the handshake. peer_connected emits after.
Verifying
Auth token validates; peers connect. Wrong token: peer_authentication_failed signal.
“Symmetric auth. Connect after.”
Related Issues
For buffer overflow, see overflow. For Synchronizer, see sync.
Match auth callbacks. Connect.