From fe554c3a5bb0139d874ccd34cc947c7628543e5b Mon Sep 17 00:00:00 2001 From: Alex Sherwin Date: Sun, 15 Dec 2024 16:09:52 -0500 Subject: [PATCH] fix(mobile): set custom headers on external url (#14707) (#14708) --- mobile/lib/services/auth.service.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mobile/lib/services/auth.service.dart b/mobile/lib/services/auth.service.dart index 0393470098..08741a15db 100644 --- a/mobile/lib/services/auth.service.dart +++ b/mobile/lib/services/auth.service.dart @@ -57,13 +57,18 @@ class AuthService { Future validateAuxilaryServerUrl(String url) async { final httpclient = HttpClient(); - final accessToken = _authRepository.getAccessToken(); bool isValid = false; try { final uri = Uri.parse('$url/users/me'); final request = await httpclient.getUrl(uri); - request.headers.add('x-immich-user-token', accessToken); + + // add auth token + any configured custom headers + final customHeaders = ApiService.getRequestHeaders(); + customHeaders.forEach((key, value) { + request.headers.add(key, value); + }); + final response = await request.close(); if (response.statusCode == 200) { isValid = true;