#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
authclient (#5761)
Anthony Stirling9a10fcb590f4
diff --git a/frontend/src-tauri/src/commands/auth.rs b/frontend/src-tauri/src/commands/auth.rsindex 65f8f6623d..cd47ed9e01 100644--- a/frontend/src-tauri/src/commands/auth.rs+++ b/frontend/src-tauri/src/commands/auth.rs@@ -336,6 +336,7 @@ pub async fn login(let client = reqwest::Client::builder().danger_accept_invalid_certs(true).timeout(std::time::Duration::from_secs(30))+ .user_agent("StirlingPDF-Desktop/1.0 Tauri").build().map_err(|e| {log::error!("Failed to create HTTP client: {}", e);@@ -689,6 +690,7 @@ async fn exchange_code_for_token(let client = reqwest::Client::builder().danger_accept_invalid_certs(true).timeout(std::time::Duration::from_secs(30))+ .user_agent("StirlingPDF-Desktop/1.0 Tauri").build().map_err(|e| {log::error!("Failed to create HTTP client: {}", e);diff --git a/frontend/src/desktop/services/authService.ts b/frontend/src/desktop/services/authService.tsindex 121e60d618..c02d67bb65 100644--- a/frontend/src/desktop/services/authService.ts+++ b/frontend/src/desktop/services/authService.ts@@ -4,6 +4,7 @@ import { open as shellOpen } from '@tauri-apps/plugin-shell';import { connectionModeService } from '@app/services/connectionModeService';import { tauriBackendService } from '@app/services/tauriBackendService';import axios from 'axios';+import tauriHttpClient from '@app/services/tauriHttpClient';import { DESKTOP_DEEP_LINK_CALLBACK, STIRLING_SAAS_URL, SUPABASE_KEY } from '@app/constants/connection';export interface UserInfo {@@ -559,8 +560,9 @@ export class AuthService {return false;}- // Call the server's refresh endpoint- const response = await axios.post(+ // Call the server's refresh endpoint using Tauri HTTP client so the desktop+ // User-Agent is sent - the backend uses it to issue long-lived desktop tokens.+ const response = await tauriHttpClient.post(`${serverUrl}/api/v1/auth/refresh`,{},{diff --git a/frontend/src/desktop/services/tauriHttpClient.ts b/frontend/src/desktop/services/tauriHttpClient.tsindex 6fcec36bbf..a887f05f14 100644--- a/frontend/src/desktop/services/tauriHttpClient.ts+++ b/frontend/src/desktop/services/tauriHttpClient.ts@@ -59,7 +59,9 @@ interface Interceptors {class TauriHttpClient {public defaults: TauriHttpRequestConfig = {baseURL: '',- headers: {},+ headers: {+ 'User-Agent': 'StirlingPDF-Desktop/1.0 Tauri',+ },timeout: 120000,responseType: 'json',withCredentials: false, // Desktop doesn't need credentials (backend has allowCredentials=false)