Immich v1.106.4 logout issue - iOS #3561

Closed
opened 2026-02-05 09:02:10 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @LucaTheHacker on GitHub (Jun 18, 2024).

The bug

Since recent updates, I've been noticing unprecedented issues with Immich login. From time to time, when I open the app, I have to log in again. Endpoint is usually kept (apart one time where it defaulted to demo), but this is becoming annoying.

I've investigated the logs, and I've noticed that AuthenticationNotifier returns ApiException 400 even if the error is related to the network:

ApiException 400: Socket operation failed: GET /users/me (Inner exception: Failed host lookup: 'photos.domain.example')

#0      IOClient.send (package:http/src/io_client.dart:94)
<asynchronous suspension>
#1      BaseClient._sendUnstreamed (package:http/src/base_client.dart:93)
<asynchronous suspension>
#2      ApiClient.invokeAPI (package:openapi/api_client.dart:101)
<asynchronous suspension>
#3      UsersApi.getMyUser (package:openapi/api/users_api.dart:177)
<asynchronous suspension>
#4      AuthenticationNotifier.setSuccessLoginInfo (package:immich_mobile/providers/authentication.provider.dart:182)
<asynchronous suspension>
#5      SplashScreenPage.build.performLoggingIn (package:immich_mobile/pages/common/splash_screen.page.dart:55)
<asynchronous suspension>

This raises an exception that causes the App to go to SplashScreenPage: Unable to login through offline or online methods - logging out completely.

After doing so, the client tries to log-out, but due to the network error, it fails as well:

ApiException 400: Socket operation failed: POST /auth/logout (Inner exception: Failed host lookup: 'photos.domain.example')

#0      IOClient.send (package:http/src/io_client.dart:94)
<asynchronous suspension>
#1      BaseClient._sendUnstreamed (package:http/src/base_client.dart:93)
<asynchronous suspension>
#2      ApiClient.invokeAPI (package:openapi/api_client.dart:96)
<asynchronous suspension>
#3      AuthenticationApi.logout (package:openapi/api/authentication_api.dart:140)
<asynchronous suspension>
#4      AuthenticationNotifier.logout.<anonymous closure> (package:immich_mobile/providers/authentication.provider.dart:106)
<asynchronous suspension>
  1. Authentication should only be reset if status_code == 401 || status_code == 403, as it's the proper code for Authorization issues.
  2. If the endpoint isn't reachable, 5xx class status codes should be used instead of 4xx, preventing the aforementioned issues
  3. If logout fails, the client shouldn't consider itself as logged out, as the logout didn't effectively happen. A force log-out may be useful, but it should be clear for the user that his session has not been closed properly.

The OS that Immich Server is running on

TrueNAS Scale

Version of Immich Server

v1.106.4

Version of Immich Mobile App

v.106.4

Platform with the issue

  • Server
  • Web
  • Mobile
Originally created by @LucaTheHacker on GitHub (Jun 18, 2024). ### The bug Since recent updates, I've been noticing unprecedented issues with Immich login. From time to time, when I open the app, I have to log in again. Endpoint is usually kept (apart one time where it defaulted to demo), but this is becoming annoying. I've investigated the logs, and I've noticed that `AuthenticationNotifier` returns `ApiException 400` even if the error is related to the network: ``` ApiException 400: Socket operation failed: GET /users/me (Inner exception: Failed host lookup: 'photos.domain.example') #0 IOClient.send (package:http/src/io_client.dart:94) <asynchronous suspension> #1 BaseClient._sendUnstreamed (package:http/src/base_client.dart:93) <asynchronous suspension> #2 ApiClient.invokeAPI (package:openapi/api_client.dart:101) <asynchronous suspension> #3 UsersApi.getMyUser (package:openapi/api/users_api.dart:177) <asynchronous suspension> #4 AuthenticationNotifier.setSuccessLoginInfo (package:immich_mobile/providers/authentication.provider.dart:182) <asynchronous suspension> #5 SplashScreenPage.build.performLoggingIn (package:immich_mobile/pages/common/splash_screen.page.dart:55) <asynchronous suspension> ``` This raises an exception that causes the App to go to SplashScreenPage: `Unable to login through offline or online methods - logging out completely`. After doing so, the client tries to log-out, but due to the network error, it fails as well: ``` ApiException 400: Socket operation failed: POST /auth/logout (Inner exception: Failed host lookup: 'photos.domain.example') #0 IOClient.send (package:http/src/io_client.dart:94) <asynchronous suspension> #1 BaseClient._sendUnstreamed (package:http/src/base_client.dart:93) <asynchronous suspension> #2 ApiClient.invokeAPI (package:openapi/api_client.dart:96) <asynchronous suspension> #3 AuthenticationApi.logout (package:openapi/api/authentication_api.dart:140) <asynchronous suspension> #4 AuthenticationNotifier.logout.<anonymous closure> (package:immich_mobile/providers/authentication.provider.dart:106) <asynchronous suspension> ``` 1. Authentication should only be reset if status_code == 401 || status_code == 403, as it's the proper code for Authorization issues. 2. If the endpoint isn't reachable, 5xx class status codes should be used instead of 4xx, preventing the aforementioned issues 3. If logout fails, the client shouldn't consider itself as logged out, as the logout didn't effectively happen. A force log-out may be useful, but it should be clear for the user that his session has not been closed properly. ### The OS that Immich Server is running on TrueNAS Scale ### Version of Immich Server v1.106.4 ### Version of Immich Mobile App v.106.4 ### Platform with the issue - [ ] Server - [ ] Web - [X] Mobile
Author
Owner

@bo0tzz commented on GitHub (Jun 18, 2024):

Dupe: #8146

@bo0tzz commented on GitHub (Jun 18, 2024): Dupe: #8146
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#3561