Server Authentication
To run your Hytale server in online mode and allow players to connect, you need to authenticate both the Hytale Downloader (for downloading server files) and the Hytale Server itself (for player authentication).
Authentication Process
Section titled “Authentication Process”Phase 1: Downloader Authentication
Section titled “Phase 1: Downloader Authentication”When you first start the container, the Hytale Downloader needs to authenticate to download the server files.
-
Start your container
The first time you run the container, you’ll see output similar to:
Please visit the following URL to authenticate:https://account.hytale.com/oauth/device?code=XXXXXXXX -
Complete the authentication
- Click the link or copy it to your browser
- Log in with your Hytale account credentials
- Authorize the application
-
Wait for download
After authentication, the downloader will automatically download the server files and start the server.
Phase 2: Server Authentication
Section titled “Phase 2: Server Authentication”Once the server starts for the first time, you need to authenticate it for online mode.
-
Check server console
After the server starts, you’ll see a message:
No server tokens configured. Use /auth login to authenticate. -
Attach to the server console
Use Docker to attach to the running container:
Terminal window docker attach container_nameOr with Docker Compose:
Terminal window docker compose attach service_name -
Initiate device authentication
In the console, run:
/auth login device -
Authorize the server
- A link with a device code will appear in the console
- Click the link or copy it to your browser
- Log in with your Hytale account
- Authorize the server application
-
Enable persistent authentication
Once authorized, save your authentication for future restarts:
/auth persistence Encrypted -
Detach from console
Press
Ctrl+Pfollowed byCtrl+Qto detach from the console without stopping the container. -
Restart the container
Terminal window docker restart container_nameOr with Docker Compose:
Terminal window docker compose restart
Using Environment Variables
Section titled “Using Environment Variables”Alternatively, you can provide authentication tokens directly via environment variables to skip the interactive authentication process.
Setting Identity Token
Section titled “Setting Identity Token”After completing the authentication steps above, you can extract the tokens and set them as environment variables for future deployments:
services: hytale: image: ghcr.io/f-gillmann/hytale-docker container_name: hytale restart: unless-stopped environment: IDENTITY_TOKEN: "identity_token" SESSION_TOKEN: "session_token" # Optional ports: - "5520:5520/udp" volumes: - ./data:/dataOr with docker run:
docker run -d \ --name hytale \ -p 5520:5520/udp \ -e IDENTITY_TOKEN="identity_token" \ -e SESSION_TOKEN="session_token" \ -v ./data:/data \ ghcr.io/f-gillmann/hytale-dockerAuthentication Modes
Section titled “Authentication Modes”The server supports three authentication modes via the AUTH_MODE environment variable. The default is authenticated.
| Mode | Description | Use Case |
|---|---|---|
authenticated | Full online authentication required (default) | Production servers, public servers |
offline | No authentication, allows any username | Testing, LAN servers |
insecure | Minimal security checks | Development only |
Using Offline Mode
Section titled “Using Offline Mode”For testing or LAN servers, you can use offline mode:
services: hytale: image: ghcr.io/f-gillmann/hytale-docker container_name: hytale restart: unless-stopped environment: AUTH_MODE: offline ports: - "5520:5520/udp" volumes: - ./data:/dataTroubleshooting
Section titled “Troubleshooting”Authentication Link Not Appearing
Section titled “Authentication Link Not Appearing”If you don’t see the authentication link:
- Ensure the container has internet access
- Check the container logs:
docker logs container_name - Verify your Hytale account is active
”No server tokens configured” After Restart
Section titled “”No server tokens configured” After Restart”If you see this message after a restart:
- Verify you ran
/auth persistence Encryptedbefore restarting - Check that the
/datavolume is properly mounted and persistent - Ensure the container has write permissions to the data directory
Token Expired Errors
Section titled “Token Expired Errors”If authentication tokens expire:
- Stop the container
- Remove the credentials file:
rm data/.hytale-downloader-credentials.json - Restart and re-authenticate following the steps above