mirror of
https://github.com/immich-app/immich.git
synced 2024-12-28 22:51:59 +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 {
|
Future<bool> validateAuxilaryServerUrl(String url) async {
|
||||||
final httpclient = HttpClient();
|
final httpclient = HttpClient();
|
||||||
final accessToken = _authRepository.getAccessToken();
|
|
||||||
bool isValid = false;
|
bool isValid = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final uri = Uri.parse('$url/users/me');
|
final uri = Uri.parse('$url/users/me');
|
||||||
final request = await httpclient.getUrl(uri);
|
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();
|
final response = await request.close();
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
isValid = true;
|
isValid = true;
|
||||||
|
|
Loading…
Reference in a new issue