mirror of
https://github.com/immich-app/immich.git
synced 2025-12-18 09:13:15 +03:00
feat(mobile): Add support for Basic Authentication (#6840)
This commit is contained in:
@@ -31,12 +31,12 @@ class ApiService {
|
||||
setEndpoint(endpoint);
|
||||
}
|
||||
}
|
||||
String? _authToken;
|
||||
String? _accessToken;
|
||||
|
||||
setEndpoint(String endpoint) {
|
||||
_apiClient = ApiClient(basePath: endpoint);
|
||||
if (_authToken != null) {
|
||||
setAccessToken(_authToken!);
|
||||
if (_accessToken != null) {
|
||||
setAccessToken(_accessToken!);
|
||||
}
|
||||
userApi = UserApi(_apiClient);
|
||||
authenticationApi = AuthenticationApi(_apiClient);
|
||||
@@ -134,8 +134,8 @@ class ApiService {
|
||||
}
|
||||
|
||||
setAccessToken(String accessToken) {
|
||||
_authToken = accessToken;
|
||||
_apiClient.addDefaultHeader('Authorization', 'Bearer $accessToken');
|
||||
_accessToken = accessToken;
|
||||
_apiClient.addDefaultHeader('x-immich-user-token', accessToken);
|
||||
}
|
||||
|
||||
ApiClient get apiClient => _apiClient;
|
||||
|
||||
Reference in New Issue
Block a user