#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
fix(auth): align token refresh handling with updated backend response (#5609)
Ludy3cdf363eabba
diff --git a/app/proprietary/src/main/java/stirling/software/proprietary/security/controller/api/AuthController.java b/app/proprietary/src/main/java/stirling/software/proprietary/security/controller/api/AuthController.javaindex 8c5e52dfe4..c7ebdbdb4f 100644--- a/app/proprietary/src/main/java/stirling/software/proprietary/security/controller/api/AuthController.java+++ b/app/proprietary/src/main/java/stirling/software/proprietary/security/controller/api/AuthController.java@@ -286,7 +286,10 @@ public class AuthController {log.debug("Token refreshed for user: {}", username);- return ResponseEntity.ok(Map.of("access_token", newToken, "expires_in", 3600));+ return ResponseEntity.ok(+ Map.of(+ "user", buildUserResponse(user),+ "session", Map.of("access_token", newToken, "expires_in", 3600)));} catch (Exception e) {log.error("Token refresh error", e);diff --git a/app/proprietary/src/test/java/stirling/software/proprietary/security/controller/api/AuthControllerLoginTest.java b/app/proprietary/src/test/java/stirling/software/proprietary/security/controller/api/AuthControllerLoginTest.javaindex 48e0700ac6..29dabe152a 100644--- a/app/proprietary/src/test/java/stirling/software/proprietary/security/controller/api/AuthControllerLoginTest.java+++ b/app/proprietary/src/test/java/stirling/software/proprietary/security/controller/api/AuthControllerLoginTest.java@@ -182,8 +182,8 @@ class AuthControllerLoginTest {mockMvc.perform(post("/api/v1/auth/refresh")).andExpect(status().isOk())- .andExpect(jsonPath("$.access_token").value("new-token"))- .andExpect(jsonPath("$.expires_in").value(3600));+ .andExpect(jsonPath("$.session.access_token").value("new-token"))+ .andExpect(jsonPath("$.session.expires_in").value(3600));}@Testdiff --git a/frontend/src/proprietary/auth/springAuthClient.ts b/frontend/src/proprietary/auth/springAuthClient.tsindex 82deb34076..9d26b8e85f 100644--- a/frontend/src/proprietary/auth/springAuthClient.ts+++ b/frontend/src/proprietary/auth/springAuthClient.ts@@ -406,6 +406,8 @@ class SpringAuthClient {// Notify listenersthis.notifyListeners('TOKEN_REFRESHED', session);+ console.debug('[SpringAuth] Token refreshed successfully');+return { data: { session }, error: null };} catch (error: unknown) {console.error('[SpringAuth] refreshSession error:', error);