1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-28 06:31:58 +00:00

fix(mobile): set custom headers on external url (#14707) (#14708)

This commit is contained in:
Alex Sherwin 2024-12-15 16:09:52 -05:00 committed by GitHub
parent dd9feeec45
commit fe554c3a5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -57,13 +57,18 @@ class AuthService {
Future<bool> 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;