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

Closed
opened 2026-02-05 16:40:31 +03:00 by OVERLORD · 0 comments
Owner

📋 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: mainHead: 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.

## 📋 Pull Request Information **Original PR:** https://github.com/NATroutter/egg-hytale/pull/11 **Author:** [@EliteScouter](https://github.com/EliteScouter) **Created:** 1/13/2026 **Status:** ✅ Merged **Merged:** 1/13/2026 **Merged by:** [@NATroutter](https://github.com/NATroutter) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (1) - [`2f37844`](https://github.com/NATroutter/egg-hytale/commit/2f378443064e826d272a9d82ce2b155a4948d90f) 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) <details> <summary>View changed files</summary> 📝 `start.sh` (+90 -41) </details> ### 📄 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 16:40:31 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/egg-hytale#44