Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: persist auto-generated API key and don't use cloud token as local key

Louis Beaumontdefd2a84c883
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/recording.rs b/apps/screenpipe-app-tauri/src-tauri/src/recording.rs
index 717042cb3..3595a2969 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/recording.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/recording.rs
@@ -425,7 +425,8 @@ pub async fn spawn_screenpipe(
// If an API key was auto-generated, persist it to the encrypted settings
// store so it survives restarts (replaces the old auth.json file approach).
if let Some(ref key) = recording_config.api_auth_key {
- if store.recording.api_key.is_empty() && store.user.api_key.is_none() && store.user.token.is_none() {
+ // Persist only if apiKey isn't already saved in settings
+ if store.recording.api_key.is_empty() {
if let Ok(tauri_store) = crate::store::get_store(&app, None) {
if let Some(mut settings_val) = tauri_store.get("settings") {
if let Some(obj) = settings_val.as_object_mut() {
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/store.rs b/apps/screenpipe-app-tauri/src-tauri/src/store.rs
index 8404135a8..4bc00fade 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/store.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/store.rs
@@ -899,16 +899,14 @@ impl SettingsStore {
data_dir,
Some(&resolved_engine),
);
- // Set the API auth key: settings apiKey > user api_key > user token > auto-generate
+ // Set the API auth key: settings apiKey > auto-generate
if config.api_auth {
let settings_key = settings.api_key.as_str();
config.api_auth_key = if !settings_key.is_empty() {
Some(settings_key.to_string())
} else {
None
- }
- .or_else(|| self.user.api_key.clone())
- .or_else(|| self.user.token.clone());
+ };
// Auto-generate if no key found — stored in the encrypted settings
// store (not auth.json) so it's protected by keychain encryption.