[PR #6840] [MERGED] feat(mobile): Add support for Basic Authentication #11366

Closed
opened 2026-02-05 14:38:13 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/immich-app/immich/pull/6840
Author: @rovo89
Created: 2/2/2024
Status: Merged
Merged: 2/4/2024
Merged by: @alextran1502

Base: mainHead: mobile_basic_auth


📝 Commits (1)

  • f2e9264 feat(mobile): Add support for Basic Authentication

📊 Changes

14 files changed (+33 additions, -33 deletions)

View changed files

📝 mobile/lib/modules/album/ui/album_thumbnail_listtile.dart (+1 -1)
📝 mobile/lib/modules/asset_viewer/views/gallery_viewer.dart (+2 -4)
📝 mobile/lib/modules/asset_viewer/views/video_viewer_page.dart (+4 -4)
📝 mobile/lib/modules/backup/services/backup.service.dart (+1 -2)
📝 mobile/lib/modules/map/widgets/positioned_asset_marker_icon.dart (+1 -2)
📝 mobile/lib/modules/memories/ui/memory_card.dart (+2 -2)
📝 mobile/lib/modules/search/ui/curated_people_row.dart (+1 -1)
📝 mobile/lib/modules/search/ui/thumbnail_with_info.dart (+1 -2)
📝 mobile/lib/modules/search/views/person_result_page.dart (+1 -2)
📝 mobile/lib/shared/providers/websocket.provider.dart (+7 -1)
📝 mobile/lib/shared/services/api.service.dart (+5 -5)
📝 mobile/lib/shared/ui/immich_image.dart (+5 -5)
📝 mobile/lib/shared/ui/user_avatar.dart (+1 -1)
📝 mobile/lib/shared/ui/user_circle_avatar.dart (+1 -1)

📄 Description

Use the x-immich-user-token header instead of Authentication: Bearer <token> to allow for Basic Authentication credentials in the server URL (e.g. https://user:pass@example.org). Most of the codebase handles the latter automatically, however the Authorization: Basic ... header used to be overwritten.

Only exception: socket_io_client doesn't seem to support getting credentials this way, so we have to add them via manually crafted Authorization header.

Tested on Android against nginx reverse proxy. With these changes, the nginx log doesn't show any unauthenticated requests anymore, so I hope I found all places.

While I was at it, I changed all variable names to accessToken. Some were called authToken, token or even jwtToken.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/immich-app/immich/pull/6840 **Author:** [@rovo89](https://github.com/rovo89) **Created:** 2/2/2024 **Status:** ✅ Merged **Merged:** 2/4/2024 **Merged by:** [@alextran1502](https://github.com/alextran1502) **Base:** `main` ← **Head:** `mobile_basic_auth` --- ### 📝 Commits (1) - [`f2e9264`](https://github.com/immich-app/immich/commit/f2e9264b2e3d62735d304131186c6f6fdbdaf797) feat(mobile): Add support for Basic Authentication ### 📊 Changes **14 files changed** (+33 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `mobile/lib/modules/album/ui/album_thumbnail_listtile.dart` (+1 -1) 📝 `mobile/lib/modules/asset_viewer/views/gallery_viewer.dart` (+2 -4) 📝 `mobile/lib/modules/asset_viewer/views/video_viewer_page.dart` (+4 -4) 📝 `mobile/lib/modules/backup/services/backup.service.dart` (+1 -2) 📝 `mobile/lib/modules/map/widgets/positioned_asset_marker_icon.dart` (+1 -2) 📝 `mobile/lib/modules/memories/ui/memory_card.dart` (+2 -2) 📝 `mobile/lib/modules/search/ui/curated_people_row.dart` (+1 -1) 📝 `mobile/lib/modules/search/ui/thumbnail_with_info.dart` (+1 -2) 📝 `mobile/lib/modules/search/views/person_result_page.dart` (+1 -2) 📝 `mobile/lib/shared/providers/websocket.provider.dart` (+7 -1) 📝 `mobile/lib/shared/services/api.service.dart` (+5 -5) 📝 `mobile/lib/shared/ui/immich_image.dart` (+5 -5) 📝 `mobile/lib/shared/ui/user_avatar.dart` (+1 -1) 📝 `mobile/lib/shared/ui/user_circle_avatar.dart` (+1 -1) </details> ### 📄 Description Use the `x-immich-user-token` header instead of `Authentication: Bearer <token>` to allow for Basic Authentication credentials in the server URL (e.g. `https://user:pass@example.org`). Most of the codebase handles the latter automatically, however the `Authorization: Basic ...` header used to be overwritten. Only exception: `socket_io_client` doesn't seem to support getting credentials this way, so we have to add them via manually crafted `Authorization` header. Tested on Android against nginx reverse proxy. With these changes, the nginx log doesn't show any unauthenticated requests anymore, so I hope I found all places. While I was at it, I changed all variable names to `accessToken`. Some were called `authToken`, `token` or even `jwtToken`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 14:38:13 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#11366