File tree Expand file tree Collapse file tree 3 files changed +6
-9
lines changed
apps/portal/src/app/(public)/auth/device-callback
packages/device-agent/src/main Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,8 @@ export default function DeviceCallbackPage() {
4747 const { code } = await response . json ( ) ;
4848
4949 // Redirect to the device agent's localhost server
50- window . location . href = `http://localhost:${ port } /auth-callback?code=${ code } &state=${ state } ` ;
50+ window . location . href = `http://localhost:${ port } /auth-callback?code=${ encodeURIComponent ( code ) } &state=${ encodeURIComponent ( state ! ) } ` ;
51+
5152 setStatus ( 'success' ) ;
5253 } catch ( err ) {
5354 console . error ( 'Device auth callback failed:' , err ) ;
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import type {
1010 StoredAuth ,
1111} from '../shared/types' ;
1212import { log } from './logger' ;
13- import { getPortalUrl , setAuth } from './store' ;
13+ import { clearAuth , getPortalUrl , setAuth } from './store' ;
1414
1515/** How long to wait for the user to complete login in the browser */
1616const LOGIN_TIMEOUT_MS = 5 * 60 * 1000 ; // 5 minutes
@@ -299,8 +299,8 @@ function errorPage(message: string): string {
299299}
300300
301301/**
302- * Sign out: clear stored auth (no more Electron session cookies to manage)
302+ * Sign out: clear stored auth data
303303 */
304304export async function performLogout ( ) : Promise < void > {
305- // Nothing to clean up — stored auth is cleared by the caller via clearAuth()
305+ clearAuth ( ) ;
306306}
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import {
1414 startScheduler ,
1515 stopScheduler ,
1616} from './scheduler' ;
17- import { clearAuth , getAuth , getLastCheckResults } from './store' ;
17+ import { getAuth , getLastCheckResults } from './store' ;
1818import {
1919 createTray ,
2020 destroyTray ,
@@ -64,7 +64,6 @@ setSessionExpiredHandler(async () => {
6464 log ( 'Session expired — clearing auth and prompting re-login' ) ;
6565 stopScheduler ( ) ;
6666 await performLogout ( ) ;
67- clearAuth ( ) ;
6867 currentResults = [ ] ;
6968 setStatus ( 'unauthenticated' ) ;
7069 notifyRenderer ( IPC_CHANNELS . AUTH_STATE_CHANGED , false ) ;
@@ -77,7 +76,6 @@ setDevicesNotFoundHandler(async () => {
7776 log ( 'All devices returned 404 — clearing auth and re-registering' ) ;
7877 stopScheduler ( ) ;
7978 await performLogout ( ) ;
80- clearAuth ( ) ;
8179 currentResults = [ ] ;
8280 setStatus ( 'unauthenticated' ) ;
8381 notifyRenderer ( IPC_CHANNELS . AUTH_STATE_CHANGED , false ) ;
@@ -128,7 +126,6 @@ const trayCallbacks = {
128126 log ( 'User signing out' ) ;
129127 stopScheduler ( ) ;
130128 await performLogout ( ) ;
131- clearAuth ( ) ;
132129 currentResults = [ ] ;
133130 setStatus ( 'unauthenticated' ) ;
134131 notifyRenderer ( IPC_CHANNELS . AUTH_STATE_CHANGED , false ) ;
@@ -179,7 +176,6 @@ ipcMain.handle(IPC_CHANNELS.LOGOUT, async () => {
179176 log ( 'Logout via IPC' ) ;
180177 stopScheduler ( ) ;
181178 await performLogout ( ) ;
182- clearAuth ( ) ;
183179 currentResults = [ ] ;
184180 setStatus ( 'unauthenticated' ) ;
185181 notifyRenderer ( IPC_CHANNELS . AUTH_STATE_CHANGED , false ) ;
You can’t perform that action at this time.
0 commit comments