Skip to content

Authentication

Hytale supports multiple authentication modes to accommodate different server use cases.

Players must have valid Hytale accounts. This is the recommended mode for public servers:

Terminal window
java -jar HytaleServer.jar --assets ../HytaleAssets --auth-mode authenticated

Features:

  • Account verification through Hytale authentication servers
  • UUIDs are consistent and tied to player accounts
  • Required for public-facing servers
  • Best security against unauthorized access

No account verification. Use for private/LAN servers only:

Terminal window
java -jar HytaleServer.jar --assets ../HytaleAssets --auth-mode offline

Features:

  • No internet connection required for authentication
  • Players can join without Hytale accounts
  • UUIDs are generated based on username (not consistent across servers)
  • Suitable for private testing or LAN parties

Similar to offline mode but with additional relaxed security. Only use for development:

Terminal window
java -jar HytaleServer.jar --assets ../HytaleAssets --auth-mode insecure

Features:

  • All security checks disabled
  • Useful for development and testing
  • Never use in production

To authenticate as a server operator, use one of the authentication commands:

For servers without a browser or display:

/auth login device

This initiates the OAuth 2.0 device authorization flow:

  1. Run the command on the server console
  2. You’ll receive a verification URL and user code
  3. Open the URL in a browser on any device
  4. Enter the code to authenticate
  5. The server will automatically complete authentication

For servers with browser access:

/auth login browser

This opens a browser window for direct OAuth authentication.

If your Hytale account has multiple game profiles, you’ll be prompted to select one:

/auth select <number>

Where <number> corresponds to the profile listed after login.

CommandDescription
/auth statusView current authentication status and token expiry
/auth logoutClear authentication and log out
/auth cancelCancel an in-progress authentication flow
/auth persistenceConfigure credential storage options

When a player connects to a server running in authenticated mode, the following authentication flow occurs:

┌─────────────┐ ┌─────────────┐ ┌───────────────────────────┐
│ Client │ │ Server │ │ sessions.hytale.com │
└─────────────┘ └─────────────┘ └───────────────────────────┘
│ │ │
│ 1. Connect with │ │
│ identity token │ │
│──────────────────▶│ │
│ │ 2. Request auth grant │
│ │────────────────────────▶│
│ │ │
│ │ 3. Auth grant response │
│ │◀────────────────────────│
│ │ │
│ 4. Server sends │ │
│ auth grant │ │
│◀──────────────────│ │
│ │ │
│ 5. Client sends │ │
│ auth token │ │
│──────────────────▶│ │
│ │ 6. Exchange for │
│ │ access token │
│ │────────────────────────▶│
│ │ │
│ │ 7. Access token │
│ │◀────────────────────────│
│ 8. Join Success │ │
│◀──────────────────│ │

The authentication process uses JWT tokens validated against the Session Service’s JWKS (JSON Web Key Set) endpoint.

OptionDescription
--auth-mode authenticatedRequire Hytale account (default)
--auth-mode offlineNo authentication required
--auth-mode insecureDevelopment mode, all security disabled

For automated deployments, you can provide authentication tokens directly:

OptionDescription
--session-token <token>Provide a session token for Session Service API
--identity-token <token>Provide an identity token (JWT)

Alternatively, tokens can be provided via environment variables:

Environment VariableDescription
HYTALE_SERVER_SESSION_TOKENSession token for Session Service API
HYTALE_SERVER_IDENTITY_TOKENIdentity token (JWT)

For singleplayer/integrated servers:

OptionDescription
--singleplayerRun in singleplayer mode
--owner-uuid <uuid>Set the owner UUID for the server
--owner-name <name>Set the owner name for the server

The authentication system is implemented in the following classes:

ClassDescription
ServerAuthManagerManages server-side authentication state and OAuth flows
SessionServiceClientHTTP client for communicating with sessions.hytale.com
JWTValidatorValidates JWT tokens against the Session Service JWKS
PlayerAuthenticationHolds player UUID and username after authentication
HandshakeHandlerHandles the client-server authentication handshake

The ServerAuthManager uses internal auth modes to track how authentication was established:

ModeDescription
NONENo authentication configured
SINGLEPLAYERRunning in singleplayer mode
EXTERNAL_SESSIONTokens provided via CLI or environment
OAUTH_BROWSERAuthenticated via browser OAuth flow
OAUTH_DEVICEAuthenticated via device OAuth flow
OAUTH_STOREAuthenticated from stored credentials

The server supports different credential storage providers:

  • Memory: Credentials stored in memory only (default)
  • Encrypted: Credentials encrypted and persisted to disk

Use /auth persistence to configure credential storage.

The server automatically refreshes tokens before expiration (with a 5-minute buffer). If the primary session refresh fails, it falls back to OAuth token refresh for modes that support it.

  1. Always use authenticated mode for public servers
  2. Keep server JARs updated for security patches
  3. Use strong server passwords when needed
  4. Monitor login attempts through server logs
  5. Use firewalls to restrict access to trusted IP ranges
  6. Use encrypted credential storage for production servers
  7. Never share session or identity tokens - they grant server access