OVERLORD opened issue starred/egg-hytale#44

OVERLORD
2026-02-05T16:40:32+03:00

44#[PR #11] [MERGED] Refactor authentication process to utilize refresh tokens#

📋 Pull Request Information

Original PR: https://github.com/NATroutter/egg-hytale/pull/11
Author: @EliteScouter
Created: 1/13/2026
Status: ✅ Merged
Merged: 1/13/2026
Merged by: @NATroutter

Base: main ← Head: main

📝 Commits (1)

2f37844 Refactor authentication process to support refresh tokens and game session creation. Updated token caching to include only refresh token and profile UUID, and added functions for refreshing access tokens and creating game sessions.

📊 Changes

1 file changed (+90 additions, -41 deletions)

View changed files

📝 start.sh (+90 -41)

📄 Description

Problem

The previous implementation cached session_token and identity_token, which expire and cannot be reused across server restarts. This caused authentication failures when restarting the server with cached credentials.

Solution

Cache only refresh_token and profile_uuid instead of session/identity tokens

Use the refresh token to obtain a fresh access token on startup

Create a new game session every time the server starts

Fall back to full device authentication if the refresh token has expired

Changes

load_cached_tokens() - Now loads only refresh_token and profile_uuid

save_auth_tokens() - Now saves only refresh_token and profile_uuid

Added refresh_access_token() - Exchanges refresh token for new access token

Added create_game_session() - Creates fresh session on each startup

Updated perform_authentication() to capture refresh token from device flow

Migration

Users with existing cache files will be prompted to re-authenticate once due to the format change, after which subsequent restarts will work without manual intervention.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.