|
| 1 | +--- |
| 2 | +title: Immich |
| 3 | +description: Use the Tinyauth OpenID Connect provider to authenticate users with Immich. |
| 4 | +--- |
| 5 | + |
| 6 | +import { Tabs, TabItem } from '@astrojs/starlight/components'; |
| 7 | +import CreateOidcClientTool from "../../../../components/create-oidc-client-tool.astro"; |
| 8 | + |
| 9 | +[Immich](https://immich.app/) is a self-hosted photo and video backup solution. By integrating Tinyauth as an OpenID Connect provider, you can centralize authentication and offer single sign-on (SSO) for your Immich users. |
| 10 | + |
| 11 | +## Requirements |
| 12 | + |
| 13 | +- A running instance of Immich |
| 14 | +- A Tinyauth instance |
| 15 | +- HTTPS configured for both services |
| 16 | + |
| 17 | +:::caution |
| 18 | +You will need to run Tinyauth with HTTPS to use it as an OpenID Connect provider. |
| 19 | +::: |
| 20 | + |
| 21 | +## Tinyauth Configuration |
| 22 | + |
| 23 | +First, generate an OIDC client for Immich in Tinyauth: |
| 24 | + |
| 25 | +<Tabs> |
| 26 | + <TabItem label="Docker"> |
| 27 | + ```sh |
| 28 | + docker run -i -t --rm ghcr.io/steveiliop56/tinyauth:v5 oidc create immich |
| 29 | + ``` |
| 30 | + </TabItem> |
| 31 | + <TabItem label="Binary"> |
| 32 | + ```sh |
| 33 | + ./tinyauth oidc create immich |
| 34 | + ``` |
| 35 | + </TabItem> |
| 36 | + <TabItem label="Browser"> |
| 37 | + <CreateOidcClientTool /> |
| 38 | + </TabItem> |
| 39 | +</Tabs> |
| 40 | + |
| 41 | +From the output, keep the generated client ID and client secret. |
| 42 | + |
| 43 | +Now, configure Tinyauth using environment variables: |
| 44 | + |
| 45 | +```sh |
| 46 | +TINYAUTH_OIDC_PRIVATEKEYPATH=/path/to/private/key.pem |
| 47 | +TINYAUTH_OIDC_PUBLICKEYPATH=/path/to/public/key.pem |
| 48 | +TINYAUTH_OIDC_CLIENTS_IMMICH_CLIENTID=client-id |
| 49 | +TINYAUTH_OIDC_CLIENTS_IMMICH_CLIENTSECRET=ta-client-secret |
| 50 | +TINYAUTH_OIDC_CLIENTS_IMMICH_TRUSTEDREDIRECTURIS=https://immich.example.com/auth/login,https://immich.example.com/user-settings,https://immich.example.com/api/oauth/mobile-redirect,app.immich:///oauth-callback |
| 51 | +TINYAUTH_OIDC_CLIENTS_IMMICH_NAME=Immich |
| 52 | +``` |
| 53 | + |
| 54 | +:::note |
| 55 | +Immich uses multiple redirect URIs depending on your clients: |
| 56 | +- Web login: `https://immich.example.com/auth/login` |
| 57 | +- Account linking in web UI: `https://immich.example.com/user-settings` - Mobile redirect endpoint: `https://immich.example.com/api/oauth/mobile-redirect` (useful if a custom scheme redirect is rejected) |
| 58 | +- Mobile app: `app.immich:///oauth-callback` |
| 59 | +::: |
| 60 | + |
| 61 | +Restart your Tinyauth instance after applying the configuration. |
| 62 | + |
| 63 | +## Immich Configuration |
| 64 | + |
| 65 | +In Immich, go to *Administration* -> *Settings* -> *Authentication Settings* and enable OAuth. Use the following values: |
| 66 | + |
| 67 | +| Field | Value | |
| 68 | +| - | - | |
| 69 | +| Enabled | `true` | |
| 70 | +| Issuer URL | Your Tinyauth URL, for example `https://tinyauth.example.com` | |
| 71 | +| Client ID | The client ID generated in the previous step | |
| 72 | +| Client Secret | The client secret generated in the previous step | |
| 73 | +| Scope | `openid email profile` | |
| 74 | +| Button Text | Optional, e.g. `Login with Tinyauth` | |
| 75 | +| Auto Register | Optional, usually `true` for first login provisioning | |
| 76 | +| Auto Launch | Optional, enable only if you want to skip the default Immich login page | |
| 77 | + |
| 78 | +:::note |
| 79 | +Immich performs OIDC discovery from the issuer URL. You can provide either: |
| 80 | +- `https://tinyauth.example.com` |
| 81 | +- `https://tinyauth.example.com/.well-known/openid-configuration` |
| 82 | +::: |
| 83 | + |
| 84 | +Save the settings, then open the Immich login page and use the OAuth button to test the flow. |
| 85 | + |
| 86 | +If authentication is successful, users are redirected to Tinyauth to sign in, then are returned to Immich as authenticated users. |
0 commit comments