Fix TypeScript error in authenticate route

Add saveToken() method to authenticationSession for saving standalone
JWT tokens without requiring a full AuthenticationResponse object.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
poduck
2025-12-29 21:23:32 -05:00
parent edc896b10e
commit 174cc94b42
2 changed files with 9 additions and 1 deletions

View File

@@ -21,7 +21,7 @@ const AuthenticatePage = () => {
} else if (token) { } else if (token) {
// Handle standalone JWT token (from embedded mode new tab) // Handle standalone JWT token (from embedded mode new tab)
// Save token directly to localStorage for persistence in new tabs // Save token directly to localStorage for persistence in new tabs
authenticationSession.saveResponse({ token }, false); authenticationSession.saveToken(token);
navigate(redirectTo); navigate(redirectTo);
} }
}, [response, token, redirectTo, navigate]); }, [response, token, redirectTo, navigate]);

View File

@@ -19,6 +19,14 @@ export const authenticationSession = {
ApStorage.getInstance().setItem(tokenKey, response.token); ApStorage.getInstance().setItem(tokenKey, response.token);
window.dispatchEvent(new Event('storage')); window.dispatchEvent(new Event('storage'));
}, },
/**
* Save a standalone JWT token directly.
* Used for auto-authentication when opening new tabs from embedded mode.
*/
saveToken(token: string) {
ApStorage.getInstance().setItem(tokenKey, token);
window.dispatchEvent(new Event('storage'));
},
isJwtExpired(token: string): boolean { isJwtExpired(token: string): boolean {
if (!token) { if (!token) {
return true; return true;