跳到主内容

Immich

Immich 是一个自托管的照片和视频库。它支持通过 Web 应用及其 iOS 和 Android 应用与任何 OpenID Connect (OIDC) 提供商进行 OAuth 登录。使用 Casdoor 作为提供商,用户可以通过他们的 Casdoor 账户登录 Immich。

在 Casdoor 中创建应用​

  1. 在 Casdoor 管理控制台中,打开用户所属的组织并添加一个应用,或打开一个现有应用。

  2. 将 Immich 回调地址添加到 Redirect URLs:

    https://photos.example.com/auth/login
    https://photos.example.com/user-settings
    app.immich:///oauth-callback

    为每个访问 Immich 的地址添加前两个 URL。最后一个用于移动应用。

  3. 保存,并记录 Client ID 和 Client secret。

在 Immich 中配置 OAuth​

  1. 在 Immich 中,前往 Administration > Settings > OAuth 并启用 OAuth。

  2. 填写设置项:

    SettingValue
    Issuer URLhttps://door.example.com
    Client ID<your-client-id>
    Client Secret<your-client-secret>
    Scopeopenid email profile
    Storage Label Claimpreferred_username
    Button TextLogin with Casdoor
    Auto RegisterOn
    • Issuer URL:Casdoor 的 URL。Immich 通过 Casdoor 的发现文档找到其余信息。
    • Storage Label Claim:根据用户的 Casdoor 用户名命名其上传文件夹。
  3. 单击保存。

验证结果​

  1. 在浏览器的隐私窗口中打开 Immich。登录页面显示 Login with Casdoor。
  2. 点击它并登录到 Casdoor。Immich 将以已登录的 Casdoor 用户身份打开。
  3. 在 Immich 移动应用中,输入服务器 URL。应用会显示相同的按钮。

已有 Immich 账户的用户可以在 Account Settings > OAuth 下将其与 Casdoor 关联。

故障排除​

SymptomCause 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 appAdd app.immich:///oauth-callback to Redirect URLs.
A new user is not createdCheck that Auto Register is on and that the Casdoor user has an email address.

另请参阅​