mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat(mobile): Add support for Basic Authentication (#6840)
This commit is contained in:
parent
b4c211cad1
commit
5061c35c8d
14 changed files with 33 additions and 33 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue