Requesting a connection token

How did we do?

When your game client wants to connect to a game server secured with netcode.io, you need to obtain a connection token from HiveMP netcode.io Auth.

Requesting a connection token via the API

To request a connection token for your game client, send a request to PUT /public/server/auth. You must use an API key that is associated with an active user session.

curl -s \
  -H "X-API-Key: $apiKey" \
  -H "Accept: application/json" \
  -H "Content-Length: 0" \
  -X PUT \
  "https://netcode-api.hivemp.com/v1/public/server/auth"\
"?id=ns-5651364608737280"

After executing this method, you'll receive the base64-encoded connection token:

{
  "connectToken": "BASE64-ENCODED-CONNECTION-TOKEN"
}

Decode the base64-encoded connection token in your game client, and provide it to the netcode.io library.

Further reading