mirror of
https://github.com/immich-app/immich.git
synced 2025-10-17 12:00:44 -04:00
fix: empty custom header prevent logging in (#20693)
This commit is contained in:
parent
7118dca559
commit
a573a23c83
@ -122,7 +122,7 @@ class AuthNotifier extends StateNotifier<AuthState> {
|
|||||||
await _apiService.setAccessToken(accessToken);
|
await _apiService.setAccessToken(accessToken);
|
||||||
|
|
||||||
final serverEndpoint = Store.get(StoreKey.serverEndpoint);
|
final serverEndpoint = Store.get(StoreKey.serverEndpoint);
|
||||||
final customHeaders = Store.get(StoreKey.customHeaders);
|
final customHeaders = Store.tryGet(StoreKey.customHeaders);
|
||||||
await _widgetService.writeCredentials(serverEndpoint, accessToken, customHeaders);
|
await _widgetService.writeCredentials(serverEndpoint, accessToken, customHeaders);
|
||||||
|
|
||||||
// Get the deviceid from the store if it exists, otherwise generate a new one
|
// Get the deviceid from the store if it exists, otherwise generate a new one
|
||||||
|
@ -11,11 +11,14 @@ class WidgetService {
|
|||||||
|
|
||||||
const WidgetService(this._repository);
|
const WidgetService(this._repository);
|
||||||
|
|
||||||
Future<void> writeCredentials(String serverURL, String sessionKey, String customHeaders) async {
|
Future<void> writeCredentials(String serverURL, String sessionKey, String? customHeaders) async {
|
||||||
await _repository.setAppGroupId(appShareGroupId);
|
await _repository.setAppGroupId(appShareGroupId);
|
||||||
await _repository.saveData(kWidgetServerEndpoint, serverURL);
|
await _repository.saveData(kWidgetServerEndpoint, serverURL);
|
||||||
await _repository.saveData(kWidgetAuthToken, sessionKey);
|
await _repository.saveData(kWidgetAuthToken, sessionKey);
|
||||||
|
|
||||||
|
if (customHeaders != null && customHeaders.isNotEmpty) {
|
||||||
await _repository.saveData(kWidgetCustomHeaders, customHeaders);
|
await _repository.saveData(kWidgetCustomHeaders, customHeaders);
|
||||||
|
}
|
||||||
|
|
||||||
// wait 3 seconds to ensure the widget is updated, dont block
|
// wait 3 seconds to ensure the widget is updated, dont block
|
||||||
Future.delayed(const Duration(seconds: 3), refreshWidgets);
|
Future.delayed(const Duration(seconds: 3), refreshWidgets);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user