feat: implement auth token synchronization between Electron and web app

- Added IPC channels for getting and setting auth tokens in Electron.
- Implemented functions to sync tokens from localStorage to Electron and vice versa.
- Updated components to ensure tokens are retrieved from Electron when not available locally.
- Enhanced user authentication flow by integrating token management across windows.
This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-04-06 23:02:25 -07:00
parent eb5799336c
commit e920923fa4
8 changed files with 82 additions and 12 deletions

View file

@ -68,4 +68,9 @@ contextBridge.exposeInMainWorld('electronAPI', {
// Browse files via native dialog
browseFiles: () => ipcRenderer.invoke(IPC_CHANNELS.BROWSE_FILES),
readLocalFiles: (paths: string[]) => ipcRenderer.invoke(IPC_CHANNELS.READ_LOCAL_FILES, paths),
// Auth token sync across windows
getAuthTokens: () => ipcRenderer.invoke(IPC_CHANNELS.GET_AUTH_TOKENS),
setAuthTokens: (bearer: string, refresh: string) =>
ipcRenderer.invoke(IPC_CHANNELS.SET_AUTH_TOKENS, { bearer, refresh }),
});