Immich
Immich 是一个自托管的照片和视频库。它支持通过 Web 应用及其 iOS 和 Android 应用与任何 OpenID Connect (OIDC) 提供商进行 OAuth 登录。使用 Casdoor 作为提供商,用户可以通过他们的 Casdoor 账户登录 Immich。
在 Casdoor 中创建应用
-
在 Casdoor 管理控制台中,打开用户所属的组织并添加一个应用,或打开一个现有应用。
-
将 Immich 回调地址添加到 Redirect URLs:
https://photos.example.com/auth/login
https://photos.example.com/user-settings
app.immich:///oauth-callback为每个访问 Immich 的地址添加前两个 URL。最后一个用于移动应用。
-
保存,并记录 Client ID 和 Client secret。
在 Immich 中配置 OAuth
-
在 Immich 中,前往 Administration > Settings > OAuth 并启用 OAuth。
-
填写设置项:
Setting Value Issuer URL https://door.example.comClient ID <your-client-id>Client Secret <your-client-secret>Scope openid email profileStorage Label Claim preferred_usernameButton Text Login with CasdoorAuto Register On - Issuer URL:Casdoor 的 URL。Immich 通过 Casdoor 的发现文档找到其余信息。
- Storage Label Claim:根据用户的 Casdoor 用户名命名其上传文件夹。
-
单击保存。
验证结果
- 在浏览器的隐私窗口中打开 Immich。登录页面显示 Login with Casdoor。
- 点击它并登录到 Casdoor。Immich 将以已登录的 Casdoor 用户身份打开。
- 在 Immich 移动应用中,输入服务器 URL。应用会显示相同的按钮。
已有 Immich 账户的用户可以在 Account Settings > OAuth 下将其与 Casdoor 关联。
故障排除
| Symptom | Cause and fix |
|---|---|
Casdoor 显示 Redirect URI: ... doesn't exist in the allowed Redirect URI list | 将错误中的 URL 添加到 Redirect URLs。Immich 需要为其每个访问地址配置一个 URL。 |
| Sign-in works in the browser but not in the mobile app | Add app.immich:///oauth-callback to Redirect URLs. |
| A new user is not created | Check that Auto Register is on and that the Casdoor user has an email address. |
另请参阅
- OAuth authentication(见 Immich 文档)