mirror of
https://github.com/immich-app/immich.git
synced 2024-12-28 06:31:58 +00:00
parent
dd9feeec45
commit
fe554c3a5b
1 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue