godotengine / godotengine/godot

the multiplayer.send_auth() returns error ERR_INVALID_PARAMETER

Open
#97,396 10 comments 0 reactions 0 assignees View on GitHub
documentation topic:multiplayer
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

reproducible in Godot Engine v4.3.stable.official.77dcf97d8

### System information

windows 11 - godot 4.3 - OpenGL API 3.3.0 NVIDIA 560.81 - Compatibility - Using Device: NVIDIA - NVIDIA GeForce RTX 3070 Ti Laptop GPU

### Issue description

if you see the example code that i provided
in line :
```
var auth_packet :PackedByteArray= "test".to_utf8_buffer()
var error = multiplayer.send_auth(id, auth_packet)
```
the `id` is `server id` and is `int 1` and the `auth_packet ` is `PackedByteArray`
and value of `error` is `31` means `ERR_INVALID_PARAMETER`

according to [documents](https://docs.godotengine.org/en/4.3/classes/class_scenemultiplayer.html#class-scenemultiplayer-method-send-auth):
the **send_auth()** input parameters is : **int** and **PackedByteArray**
and im passing correct values to it. but returns **ERR_INVALID_PARAMETER**

i think this is a bug

### Steps to reproduce

```
extends Node3D

var port=8083
var ip='127.0.0.1'

func createServer()->void:
var server_peer := ENetMultiplayerPeer.new()
server_peer.create_server(port)
multiplayer.multiplayer_peer = server_peer
multiplayer.auth_callback = Callable(self, "_auth_request_handler")
multiplayer.peer_authenticating.connect(_on_peer_authenticating)

func _auth_request_handler(peer_id: int, auth_data: PackedByteArray)->void:
print('_auth_request_handler: ',peer_id)

func _on_peer_authenticating(peer_id:int)->void:
print("Peer is authenticating: ", peer_id)

func joinServer()->void:
var client_peer := ENetMultiplayerPeer.new()
client_peer.create_client(ip,port)
multiplayer.multiplayer_peer = client_peer
multiplayer.peer_connected.connect (inClientSide_clientConnected)

func inClientSide_clientConnected(id:int)->void:

if id==1:

var auth_packet :PackedByteArray= "test".to_utf8_buffer()

# Send the authentication data to the server
var error = multiplayer.send_auth(id, auth_packet)
print(id,' ',error)
```

### Minimal reproduction project (MRP)

[test2.zip](https://github.com/user-attachments/files/17109645/test2.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.