Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(forms): give form errors a readable color in the Next themes
Elian Doran4571e644282a
diff --git a/apps/client/src/setup.tsx b/apps/client/src/setup.tsxindex 41f261229d..e2874893d0 100644--- a/apps/client/src/setup.tsx+++ b/apps/client/src/setup.tsx@@ -751,7 +751,6 @@ export function SyncFromServer({ setState }: { setState: (state: State) => void<CardSection><FormGrouplabel={t("setup.server-totp-token")} name="serverTotpToken"- description={t("setup.server-totp-token-description")}error={refusedFactor === "totp-required" ? t("setup.totp-required"): refusedFactor === "totp" ? t("setup.wrong-totp") : undefined}>diff --git a/apps/client/src/stylesheets/theme-next-dark.css b/apps/client/src/stylesheets/theme-next-dark.cssindex a32bb7af2f..5a43002625 100644--- a/apps/client/src/stylesheets/theme-next-dark.css+++ b/apps/client/src/stylesheets/theme-next-dark.css@@ -22,6 +22,7 @@--dropdown-border-color: #404040;--dropdown-shadow-opacity: 0.6;--dropdown-item-icon-destructive-color: #d58477;+ --form-error-text-color: #ff8a80;--contextual-help-icon-color: #7fd2ef;--accented-background-color: #555;diff --git a/apps/client/src/stylesheets/theme-next-light.css b/apps/client/src/stylesheets/theme-next-light.cssindex be3d606a29..d2a03bd32f 100644--- a/apps/client/src/stylesheets/theme-next-light.css+++ b/apps/client/src/stylesheets/theme-next-light.css@@ -22,6 +22,7 @@--dropdown-border-color: #ccc;--dropdown-shadow-opacity: 0.2;--dropdown-item-icon-destructive-color: #de4027;+ --form-error-text-color: #b3261e;--contextual-help-icon-color: #004382;--accented-background-color: #f5f5f5;diff --git a/apps/client/src/stylesheets/theme-next/forms.css b/apps/client/src/stylesheets/theme-next/forms.cssindex c54509d880..bd11e33b77 100644--- a/apps/client/src/stylesheets/theme-next/forms.css+++ b/apps/client/src/stylesheets/theme-next/forms.css@@ -118,6 +118,12 @@ input::selection,opacity: 0.8;}+.form-text.text-danger {+ /* Bootstrap's `.text-danger` sets its color with `!important`. */+ color: var(--form-error-text-color) !important;+ opacity: 1;+}+/* Input groups */.input-group {diff --git a/apps/client/src/translations/en/entry.json b/apps/client/src/translations/en/entry.jsonindex 3bfa433699..bf72baf735 100644--- a/apps/client/src/translations/en/entry.json+++ b/apps/client/src/translations/en/entry.json@@ -81,9 +81,8 @@"proxy-instruction": "If you leave proxy setting blank, system proxy will be used.","dismiss-error": "Dismiss error","wrong-password": "Incorrect password. Please try again.",- "server-totp-token": "One-time password or recovery code",- "server-totp-token-description": "Only needed if two-factor authentication is enabled on the server.",- "totp-required": "The server uses two-factor authentication. Enter the one-time password from your authenticator app, or a recovery code.",+ "server-totp-token": "One-time password or recovery code (optional)",+ "totp-required": "This server requires a one-time password or a recovery code.","wrong-totp": "Incorrect one-time password or recovery code. Please try again.","language": "Language","continue": "Continue",diff --git a/apps/server/src/assets/help/help_content.json b/apps/server/src/assets/help/help_content.jsonindex 592ad76ddd..d85d59bd2b 100644--- a/apps/server/src/assets/help/help_content.json+++ b/apps/server/src/assets/help/help_content.json@@ -23,7 +23,7 @@"_help_l2VkvOwUNfZj": "<p>Configuring TLS is essential for <a href=\"#root/_help_WOcw2SLH6tbX\">server installation</a> in Trilium. This guide details the steps to set up TLS within Trilium itself.</p><aside class=\"admonition tip\"><p>While Trilium supports HTTPS on its own, it's generally a good idea to use a <a href=\"#root/_help_vcjrb3VVYPZI\">reverse proxy</a> instead with TLS termination. You can follow a <a href=\"https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04\">guide like this</a> for such setups.</p></aside><h2>Obtaining a TLS Certificate</h2><p>You have two options for obtaining a TLS certificate:</p><ul><li><strong>Recommended</strong>: Obtain a TLS certificate signed by a root certificate authority. For personal use, <a href=\"https://letsencrypt.org\">Let's Encrypt</a> is an excellent choice. It is free, automated, and straightforward. Certbot can facilitate automatic TLS setup.</li><li>Generate a self-signed certificate. This option is not recommended due to the additional complexity of importing the certificate into all machines connecting to the server.</li></ul><h2>Modifying <code>config.ini</code></h2><p>Once you have your certificate, modify the <code>config.ini</code> file in the <a href=\"#root/_help_tAassRL4RSQL\">data directory</a> to configure Trilium to use it:</p><pre><code class=\"language-text-x-trilium-auto\">[Network]\nport=8080\n# Set to true for TLS/SSL/HTTPS (secure), false for HTTP (insecure).\nhttps=true\n# Path to the certificate (run \"bash bin/generate-cert.sh\" to generate a self-signed certificate).\n# Relevant only if https=true\ncertPath=/[username]/.acme.sh/[hostname]/fullchain.cer\nkeyPath=/[username]/.acme.sh/[hostname]/example.com.key</code></pre><p>You can also review the <a href=\"#root/_help_Gzjqa934BdH4\">configuration</a> file to provide all <code>config.ini</code> values as environment variables instead. For example, you can configure TLS using environment variables:</p><pre><code class=\"language-text-x-trilium-auto\">export TRILIUM_NETWORK_HTTPS=true\nexport TRILIUM_NETWORK_CERTPATH=/path/to/cert.pem\nexport TRILIUM_NETWORK_KEYPATH=/path/to/key.pem</code></pre><p>The above example shows how this is set up in an environment where the certificate was generated using Let's Encrypt's ACME utility. Your paths may differ. For Docker installations, ensure these paths are within a volume or another directory accessible by the Docker container, such as <code>/home/node/trilium-data/[DIR IN DATA DIRECTORY]</code>.</p><p>After configuring <code>config.ini</code>, restart Trilium and access the hostname using \"https\".</p><h2>Self-Signed Certificate</h2><p>If you opt to use a self-signed certificate for your server instance, note that the desktop instance will not trust it by default.</p><p>To bypass this, disable certificate validation by setting the following environment variable (for Linux):</p><pre><code class=\"language-text-x-trilium-auto\">export NODE_TLS_REJECT_UNAUTHORIZED=0\ntrilium</code></pre><p>Trilium provides scripts to start in this mode, such as <code>trilium-no-cert-check.bat</code> for Windows.</p><p><strong>Warning</strong>: Disabling TLS certificate validation is insecure. Proceed only if you fully understand the implications.</p>","_help_0hzsNCP31IAB": "<h2>Disabling authentication</h2><p>If you are running Trilium on <code>localhost</code> only or if authentication is handled by another component, you can disable Trilium’s authentication by adding the following to <code>config.ini</code>:</p><pre><code class=\"language-text-x-trilium-auto\">[General]\nnoAuthentication=true</code></pre><p>Disabling authentication will bypass even the <a class=\"reference-link\" href=\"#root/_help_7DAiwaf8Z7Rz\">Multi-Factor Authentication</a> since v0.94.1.</p><h2>Understanding how the session works</h2><p>Once logged into Trilium, the application will store this information about the login into a cookie on the browser, but also as a session on the server.</p><p>If “Remember me” is checked, then the login will expire in 21 days. This period can be adjusted by modifying the <code>Session.cookieMaxAge</code> value in <code>config.ini</code>. For example, to have the session expire in one day:</p><pre><code class=\"language-text-x-trilium-auto\">[Session]\ncookieMaxAge=86400</code></pre><p>When “Remember me” is unchecked, the behavior is different. At client/browser level the authentication does not have any expiration date, but it will be automatically cleared as soon as the user closes the browser. Nevertheless, the server will also dismiss this authentication in around 24 hours from the <em>last interaction with the application</em>.</p><h2>Viewing active sessions</h2><p>The login sessions are now stored in the same <a class=\"reference-link\" href=\"#root/_help_wX4HbRucYSDD\">Database</a> as the user data. In order to view which sessions are active, open the <a class=\"reference-link\" href=\"#root/_help_YKWqdJhzi2VY\">SQL Console</a> and run the following query:</p><pre><code class=\"language-text-x-trilium-auto\">SELECT * FROM sessions</code></pre><p>Expired sessions are periodically cleaned by the server, generally an hourly interval.</p><h2>See also</h2><ul><li><a class=\"reference-link\" href=\"#root/_help_7DAiwaf8Z7Rz\">Multi-Factor Authentication</a></li></ul>","_help_lwAX5SvbrK2g": "<aside class=\"admonition important\"><p>If you forget your password:</p><ul><li>Protected notes are irretrievable without the password.</li><li>Unprotected notes can be recovered.</li></ul></aside><p>There are two options, both involving access to the device that is running your server.</p><h3>By disabling authentication</h3><ol><li>See <a class=\"reference-link\" href=\"#root/_help_0hzsNCP31IAB\">Authentication</a> on how to disable the authentication.</li><li>Restart the server.</li><li>Go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → Password → Reset password.</li><li>Re-enable authentication by following step (1) in reverse.</li><li>Restart the server.</li><li>Log in with the new password.</li></ol><h3>By altering the database</h3><ol><li><p>Access the <a href=\"#root/_help_wX4HbRucYSDD\">database</a> file in the <a href=\"#root/_help_tAassRL4RSQL\">data directory</a>. Open the <code>document.db</code> file with an SQLite client (e.g., <a href=\"https://sqlitebrowser.org/\">DB Browser</a>).</p></li><li><p>Execute the following queries:</p><pre><code class=\"language-text-x-trilium-auto\">UPDATE options SET value = '77/twC5O00cuQgNC63VK32qOKKYwj21ev3jZDXoytVU=' WHERE name = 'passwordVerificationSalt';\nUPDATE options SET value = '710BMasZCAgibzIc07X4P9Q4TeBd4ONnqJOho+pWcBM=' WHERE name = 'passwordDerivedKeySalt';\nUPDATE options SET value = 'Eb8af1/T57b89lCRuS97tPEl4CwxsAWAU7YNJ77oY+s=' WHERE name = 'passwordVerificationHash';\nUPDATE options SET value = 'QpC8XoiYYeqHPtHKRtbNxfTHsk+pEBqVBODYp0FkPBa22tlBBKBMigdLu5GNX8Uu' WHERE name = 'encryptedDataKey';</code></pre></li><li><p>After executing the changes, commit/write the changes. <strong>This sets the password to</strong> <code>**password**</code><strong>, allowing you to log in again.</strong></p></li><li><p>Go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Password</em> → <em>Change password</em> and replace the unsafe password.</p></li></ol><h2>Handling protected notes</h2><p>When the password is reset, the protected notes are permanently lost due to the fact that they are encrypted with your password so there is no way for Trilium to recover them.</p><p>For pre-existing protected notes (now unrecoverable), consider deleting them or exporting the unprotected notes. Then, delete <code>document.db</code> and start fresh.</p>",- "_help_7DAiwaf8Z7Rz": "<p>Multi-factor authentication (MFA) is a security process that requires users to provide two or more verification factors to gain access to a system, application, or account. This adds an extra layer of protection beyond just using a password.</p><p>By requiring more than one verification method, MFA helps reduce the risk of unauthorized access, even if someone has obtained your password. It’s highly recommended for securing sensitive information stored in your notes.</p><h2>Relationship to OpenID Connect (OIDC)</h2><p>Multi-factor authentication makes your Trilium login safer by requiring an additional proof of identity apart from your password. <a class=\"reference-link\" href=\"#root/_help_x1lQNKQBqLcA\">Signing in with OpenID Connect</a> is a different concept which delegates your authentication to an external provider (e.g. your Google provider, or a self-hosted one such as Authelia). These authentication providers might provide their own security features such as TOTP or passkeys.</p><h2>Time-based one-time password (TOTP)</h2><p>TOTP (Time-Based One-Time Password) is a security feature that generates a unique, temporary code on your device, like a smartphone, which changes every 30 seconds. You use this code, along with your password, to log into your account, making it much harder for anyone else to access them.</p><ol><li>Go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Password & Auth.</em></li><li>Make sure <em>Sign-in with</em> has <em>Local password</em> selected.</li><li>In the <em>Two-factor authentication</em> section, press <em>Set up.</em></li><li>Scan the QR code or manually enter the code in your authenticator app.</li><li>Enter the verification code from your authenticator app to confirm that the setup was successful and press <em>Verify & continue</em>.</li><li>Save the recovery codes, then tick the confirmation and press <em>Finish setup</em>.</li><li>Re-login will be required after TOTP setup is finished (After you refreshing the page).</li></ol><h2>Connecting a device to the server</h2><p>Once TOTP is enabled, connecting a new desktop or mobile app to the server through <a class=\"reference-link\" href=\"#root/_help_cbkrhQjrkKrh\">Synchronization</a> also asks for the second factor. On the <em>Connect to an existing server</em> screen, enter a one-time password or a recovery code in <em>One-time password or recovery code</em>, next to the server's password. Without it, the server refuses to set up the sync.</p><p>The second factor is only asked for when a device is first connected. A device that is already set up keeps syncing without it.</p><aside class=\"admonition note\"><p>Versions prior to v0.107.0 do not ask for the second factor when setting up the sync. Update the desktop and mobile apps along with the server, since older apps have no field to send it.</p></aside><h2>Recovery codes</h2><p>Recovery codes can be used in place of the TOTP if you lose access to your authenticator. Trilium provides 8 different recovery codes, each recovery code can be used once.</p><p>To use a recovery code, simply login with your password and use the recovery code as the security token.</p><p>The initial set of recovery codes is generated when setting up your TOTP for the first time. They can be regenerated at any time by going to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Password & Auth</em> and pressing the <em>Regenerate recovery codes</em> button. This will generate a new set of recovery codes while at the same time disabling the previous ones.</p>",+ "_help_7DAiwaf8Z7Rz": "<p>Multi-factor authentication (MFA) is a security process that requires users to provide two or more verification factors to gain access to a system, application, or account. This adds an extra layer of protection beyond just using a password.</p><p>By requiring more than one verification method, MFA helps reduce the risk of unauthorized access, even if someone has obtained your password. It’s highly recommended for securing sensitive information stored in your notes.</p><h2>Relationship to OpenID Connect (OIDC)</h2><p>Multi-factor authentication makes your Trilium login safer by requiring an additional proof of identity apart from your password. <a class=\"reference-link\" href=\"#root/_help_x1lQNKQBqLcA\">Signing in with OpenID Connect</a> is a different concept which delegates your authentication to an external provider (e.g. your Google provider, or a self-hosted one such as Authelia). These authentication providers might provide their own security features such as TOTP or passkeys.</p><h2>Time-based one-time password (TOTP)</h2><p>TOTP (Time-Based One-Time Password) is a security feature that generates a unique, temporary code on your device, like a smartphone, which changes every 30 seconds. You use this code, along with your password, to log into your account, making it much harder for anyone else to access them.</p><ol><li>Go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Password & Auth.</em></li><li>Make sure <em>Sign-in with</em> has <em>Local password</em> selected.</li><li>In the <em>Two-factor authentication</em> section, press <em>Set up.</em></li><li>Scan the QR code or manually enter the code in your authenticator app.</li><li>Enter the verification code from your authenticator app to confirm that the setup was successful and press <em>Verify & continue</em>.</li><li>Save the recovery codes, then tick the confirmation and press <em>Finish setup</em>.</li><li>Re-login will be required after TOTP setup is finished (After you refreshing the page).</li></ol><h2>Connecting a device to the server</h2><p>Once TOTP is enabled, connecting a new desktop or mobile app to the server through <a class=\"reference-link\" href=\"#root/_help_cbkrhQjrkKrh\">Synchronization</a> also asks for the second factor. On the <em>Connect to an existing server</em> screen, enter a one-time password or a recovery code in <em>One-time password or recovery code</em>, below the server's password. Without it, the server refuses to set up the sync.</p><p>The second factor is only asked for when a device is first connected. A device that is already set up keeps syncing without it.</p><aside class=\"admonition note\"><p>Versions prior to v0.107.0 do not ask for the second factor when setting up the sync. Update the desktop and mobile apps along with the server, since older apps have no field to send it.</p></aside><h2>Recovery codes</h2><p>Recovery codes can be used in place of the TOTP if you lose access to your authenticator. Trilium provides 8 different recovery codes, each recovery code can be used once.</p><p>To use a recovery code, simply login with your password and use the recovery code as the security token.</p><p>The initial set of recovery codes is generated when setting up your TOTP for the first time. They can be regenerated at any time by going to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Password & Auth</em> and pressing the <em>Regenerate recovery codes</em> button. This will generate a new set of recovery codes while at the same time disabling the previous ones.</p>","_help_x1lQNKQBqLcA": "<p>OpenID is a standardized way to let you log into websites using an account from another service, like Google or Authelia, to verify your identity.</p><p>When OpenID is activated, the password-based authentication in Trilium is replaced with a button that connects using your provider. This means that the configuration of <a class=\"reference-link\" href=\"#root/_help_7DAiwaf8Z7Rz\">Multi-factor authentication with TOTP</a> no longer takes effect, since your provider has to handle any multi-factor authentication.</p><h2>Setup</h2><p>Setting up authentication with OpenID connect is a two-step process:</p><ol><li>First the Trilium server must be configured with information about your authentication provider such as the URL, client ID and secret.</li><li>Second, the user must connect from options to create a link between the account on the provider and the one Trilium has.</li></ol><h3>Configuring the authentication provider</h3><ol><li><p>First, make sure the authentication provider (e.g. Google, Authelia) is configured properly. See <a class=\"reference-link\" href=\"#root/_help_IgkTHSaFfq6A\">Setting up with various providers</a> for concrete examples.</p><ol><li>The redirect URL of Trilium is <code>https://<your-trilium-domain>/callback</code>.</li><li>You should obtain the base URL, client ID and client secret.</li></ol></li><li><p>Set the following information using <a class=\"reference-link\" href=\"#root/_help_Gzjqa934BdH4\">Configuration (config.ini or environment variables)</a>:</p><figure class=\"table\"><table><thead><tr><th>Configuration</th><th><code>config.ini</code> in <code>[MultiFactorAuthentication]</code> section</th><th>Environment variable</th><th>Description</th></tr></thead><tbody><tr><td>Base URL*</td><td><code>oauthBaseUrl</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHBASEURL</code></td><td>The URL of your Trilium instance (e.g. <code>https://example.com</code>).</td></tr><tr><td>Client ID*</td><td><code>oauthClientId</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTID</code></td><td>The client ID from your provider configuration.</td></tr><tr><td>Client Secret*</td><td><code>oauthClientSecret</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTSECRET</code></td><td>The client secret from your provider configuration.</td></tr><tr><td>Client auth method</td><td><code>oauthClientAuthMethod</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTAUTHMETHOD</code></td><td>Token-endpoint auth method: <code>client_secret_basic</code> or <code>client_secret_post</code>. Empty auto-detects. Only needed if sign-in fails with a <code>WWW-Authenticate</code> or <code>invalid_client</code> error.</td></tr><tr><td>ID token algorithm</td><td><code>oauthIdTokenSigningAlg</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHIDTOKENSIGNINGALG</code></td><td><span style=\"color:rgb(32,32,32);\">The algorithm your provider signs ID tokens with, e.g.</span> <code>RS256</code><span style=\"color:rgb(32,32,32);\">,</span> <code>EdDSA</code><span style=\"color:rgb(32,32,32);\">,</span> <code>ES256</code><span style=\"color:rgb(32,32,32);\">. Empty auto-detects from the provider. Only needed if sign-in fails with an</span> <code>unexpected JWT alg</code> <span style=\"color:rgb(32,32,32);\">error.</span></td></tr></tbody></table></figure><p>Asterisk (*) marks a required field</p></li><li><p>The default OAuth issuer is Google. To use other services such as Authentik or Auth0, you can configure the settings via <code>oauthIssuerBaseUrl</code>, <code>oauthIssuerName</code>, and <code>oauthIssuerIcon</code> in the <code>config.ini</code> file. Alternatively, these values can be set using environment variables:</p><figure class=\"table\"><table><thead><tr><th>Configuration</th><th><code>config.ini</code> in <code>[MultiFactorAuthentication]</code> section</th><th>Environment variable</th><th>Description</th></tr></thead><tbody><tr><td>Issuer base URL</td><td><code>oauthIssuerBaseUrl</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERBASEURL</code></td><td>Either the issuer itself (<code>https://auth.example.com</code>) or a full discovery URL (<code>https://auth.example.com/.well-known/openid-configuration</code>). <br> <br>A URL containing <code>/.well-known/</code> is used as-is<span style=\"color:rgb(32,32,32);\">, which is convenient when your provider hands you a discovery URL to copy. A trailing slash may be included or omitted; Trilium matches whichever spelling the provider advertises.</span> <br> <br>Use the full form when your provider advertises an issuer that differs from the path serving its discovery document, such as Authentik in \"global\" issuer mode.</td></tr><tr><td>Issuer name</td><td><code>oauthIssuerName</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERNAME</code></td><td>The name of your authentication provider, used for reference on the login screen and in settings. Default is “Google”.</td></tr><tr><td>Issuer icon</td><td><code>oauthIssuerIcon</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERICON</code></td><td>Optionally, the URL to a logo of the provider. By default it will try to obtain the favicon from the website, so it's optional.</td></tr></tbody></table></figure><p>All the fields here are optional, since the default OAuth issuer is Google.</p></li><li><p>Optionally, tune the following advanced settings. All are optional and have sensible defaults:</p><figure class=\"table\"><table><thead><tr><th>Configuration</th><th><code>config.ini</code> in <code>[MultiFactorAuthentication]</code> section</th><th>Environment variable</th><th>Description</th></tr></thead><tbody><tr><td>HTTP timeout</td><td><code>oauthHttpTimeout</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHHTTPTIMEOUT</code></td><td>Timeout in milliseconds for the provider HTTP requests (discovery, token exchange, userinfo). Defaults to <code>30000</code> (30s). Raise this if your provider cold-starts slowly and you are occasionally asked to sign in twice. Minimum accepted value is <code>500</code>.</td></tr><tr><td>Scopes</td><td><code>oauthScope</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHSCOPE</code></td><td>Space-separated list of OIDC scopes requested at login. Defaults to <code>openid profile email</code>. <code>openid</code> is required and is prepended automatically if you omit it.</td></tr></tbody></table></figure><p>The OIDC session lifetime is automatically bound to Trilium's own session cookie lifetime (the <code>cookieMaxAge</code> setting in the <code>[Session]</code> section, 21 days by default), so a single sign-in stays valid for as long as your Trilium session does rather than expiring early on the OIDC library's shorter internal defaults.</p></li><li><p>Restart the server so that the changes are applied.</p></li></ol><aside class=\"admonition note\"><p>Legacy environment variables are also supported: <code>TRILIUM_OAUTH_BASE_URL</code>, <code>TRILIUM_OAUTH_CLIENT_ID</code>, <code>TRILIUM_OAUTH_CLIENT_SECRET</code>, and for customizing the provider: <code>TRILIUM_OAUTH_ISSUER_BASE_URL</code>, <code>TRILIUM_OAUTH_ISSUER_NAME</code>, <code>TRILIUM_OAUTH_ISSUER_ICON</code>, <code>TRILIUM_OAUTH_HTTP_TIMEOUT</code>, <code>TRILIUM_OAUTH_SCOPE</code>, <code>TRILIUM_OAUTH_CLIENT_AUTH_METHOD</code>, <code>TRILIUM_OAUTH_ID_TOKEN_SIGNING_ALG</code>.</p></aside><h2>Connecting to the authentication provider</h2><p>Once the server has been configured at the previous step, the next step is to create a link between your account on the authentication provider and the Trilium instance. This makes sure that only you can access the Trilium instance, and not just any other valid account.</p><p>To do so:</p><ol><li>Go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Password & Auth.</em></li><li>In the <em>Sign-in with</em> field, choose <em>OpenID Connect provider.</em></li><li>In the <em>OpenID Connect</em> section, look for the <em>Connect account</em> (<span class=\"tn-icon bx bx-log-in\"></span>) button.</li><li>This will redirect you to your authentication provider, where you can sign in or confirm the action if needed.</li><li>Once you are authenticated you will be redirected back to the Trilium application.</li></ol><h2>Logging out</h2><p>When logging out of Trilium, a request is made to the authentication provider to log out from there as well. This feature depends on the authentication provider, so it may not be honored (Google and Authelia are known cases in which they don't respect the logout feature).</p><h2>Switching providers</h2><p>When switching providers (e.g. going from Google to Authelia), it's important to take the following steps:</p><ol><li>Go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Password & Auth</em>.</li><li>In the <em>OpenID Connect</em> section, press the <em>Disconnect</em> (<span class=\"tn-icon bx bx-trash\"></span>) button.</li><li>Wait for the section to indicate that you are disconnected.</li><li>Change the configuration pointing to the new provider.</li><li>Restart your server.</li><li>Repeat the normal steps to connect to the authentication provider.</li></ol><p>Failing to disconnect before switching providers might temporarily lock you in, as you will not be able to login (credentials won't match). Should this happen:</p><ol><li>Modify the server configuration again to your old provider.</li><li>Restart the server and follow the disconnect instructions above.</li><li>Modify the server configuration again to your new provider.</li><li>Restart again the server.</li></ol><h2>Deactivating OpenID Connect temporarily</h2><p>To disable the OpenID Connect authentication and instead rely on the local password temporarily, you must:</p><ol><li>Modify the <code>config.ini</code> or environment variables (depending on how you set up the provider information) and temporarily deactivate the multi-factor authentication section by renaming <code>[MultiFactorAuthentication]</code> to something else (e.g. <code>[MultiFactorAuthentication.bak]</code>.</li><li>Restart the server for the changes to take effect.</li></ol><h2>Troubleshooting</h2><h3>Setup fails with a <code>WWW-Authenticate</code> or <code>invalid_client</code> error</h3><p>Your provider disagrees with Trilium about how client credentials should be sent to the token endpoint. Set <code>oauthClientAuthMethod</code> to <code>client_secret_post</code> (or <code>client_secret_basic</code> if it's already set to post) and restart. Providers vary: some reject <code>client_secret_post</code> outright because the method is fixed when the client is registered (e.g. Authelia), so if one value doesn't work, try the other.</p><h3>Setup fails with <code>invalid user</code></h3><p>If you are running behind a <a href=\"#root/_help_vcjrb3VVYPZI\">reverse proxy</a>, a buffer overflow can also cause this issue. Here is a sample fix for <a class=\"reference-link\" href=\"#root/_help_ud6MShXL4WpO\">Nginx</a>: </p><pre><code class=\"language-text-x-trilium-auto\">proxy_buffer_size 128k;\nproxy_buffers 4 256k;\nproxy_busy_buffers_size 256k;</code></pre><h3>Setup fails with an <code>unexpected JWT alg</code> error</h3><p>Depending on your version the message reads <code>unexpected JWT \"alg\" header parameter</code> or <code>unexpected JWT alg received, expected RS256, got: EdDSA</code>. Both mean the same thing: your provider signs ID tokens with an algorithm other than RS256. Pocket ID (Ed25519) and Kanidm (ES256) do this.</p><p>From v0.104.2 Trilium detects the algorithm from your provider automatically, and the log records the outcome (<code>OAuth: the issuer does not sign ID tokens with RS256; expecting ES256</code>). If detection can't reach the provider it falls back to RS256, so check that the issuer URL is correct and reachable first. Should it still fail, set <code>oauthIdTokenSigningAlg</code> explicitly to the algorithm your provider uses.</p><h3>Setup fails with <code>OAUTH_RESPONSE_IS_NOT_CONFORM</code></h3><p>Make sure the base URL is correct and that the identity provider actually supports OpenID Connect. Some providers such as GitHub offer only OAuth 2.0.</p>","_help_IgkTHSaFfq6A": "<p>This page contains instructions on how to set up <a class=\"reference-link\" href=\"#root/_help_x1lQNKQBqLcA\">Signing in with OpenID Connect</a> with various providers such as Authelia, GitLab, Google.</p><aside class=\"admonition note\"><p>While the configuration reference is correct and up to date, the steps to create the OAuth application might differ slightly as providers change their UI.</p></aside><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">Authelia</p><div class=\"trilium-tab-panel\"><ol><li><p>Generate a client secret:</p><pre><code class=\"language-text-x-trilium-auto\">authelia crypto hash generate pbkdf2 --variant sha512 --random --random.length 72 --random.charset rfc3986\n</code></pre><p><code>Random Password</code> goes to Trilium, <code>Digest</code> (the <code>$pbkdf2-sha512$…</code> string) goes to Authelia.</p></li><li><p>Add a client under <code>identity_providers.oidc.clients</code> in Authelia's <code>configuration.yml</code>, replacing <code><server></code> with the URL of your Trilium instance:</p><pre><code class=\"language-text-x-yaml\">identity_providers:\n oidc:\n clients:\n - client_id: 'trilium'\n client_name: 'Trilium'\n client_secret: '<Digest>'\n public: false\n authorization_policy: 'two_factor'\n redirect_uris:\n - 'https://<server>/callback'\n scopes:\n - 'openid'\n - 'profile'\n - 'email'</code></pre><p>Unlike GitLab, <code>client_id</code> is a name you choose rather than one the provider generates.</p></li><li><p>Restart Authelia.</p></li></ol><p>Adjust <code>config.ini</code>, using the <code>Random Password</code> from step 1:</p><pre><code class=\"language-text-x-trilium-auto\">[MultiFactorAuthentication]\noauthBaseUrl=https://<server>\noauthClientId=<ClientId>\noauthClientSecret=<RandomPassword>\noauthIssuerBaseUrl=https://<server>\noauthIssuerName=Authelia</code></pre><aside class=\"admonition important\"><p>Do <strong>not</strong> set <code>oauthClientAuthMethod</code> for Authelia. It defaults confidential clients to <code>client_secret_basic</code> and rejects any other method with <code>invalid_client</code>, which is the default Trilium already uses. This is the opposite of the GitLab case below.</p></aside></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><span class=\"tn-icon bx bxl-gitlab\"></span> GitLab</p><div class=\"trilium-tab-panel\"><ol><li>Go to user settings on <a href=\"https://gitlab.com/-/user_settings/applications\">gitlab.com</a> or your own self-hosted instance.</li><li>Press <em>Add new application</em>.</li><li>Give it a name (e.g. Trilium).</li><li>Set <em>Redirect URI</em> to <code>https://<server>/callback</code></li><li>Make sure <em>Confidential</em> is checked and <em>Device authorization grant</em> is unchecked.</li><li>Under scopes, check <em>openid</em>, <em>profile</em> and <em>email</em> (they should be near the end).</li><li>Save the application and copy the <em>Application ID</em> and <em>Secret</em>.</li></ol><p>Adjust <code>config.ini</code> as follows, replacing <code><ApplicationId></code> and <code><Secret></code> with the values from the last step as well as the <code><server></code> with a URL to your Trilium instance.</p><pre><code class=\"language-text-x-trilium-auto\">[MultiFactorAuthentication]\noauthBaseUrl=https://<server>\noauthClientId=<ApplicationId>\noauthClientSecret=<Secret>\noauthIssuerBaseUrl=https://gitlab.com\noauthIssuerName=GitLab\noauthClientAuthMethod=client_secret_post\n</code></pre><aside class=\"admonition important\"><p>If you are using a self-hosted instance of GitLab, make sure to also update <code>oauthIssuerBaseUrl</code>, and keep the <code>oauthClientAuthMethod</code> line above.</p><p>GitLab's token endpoint does not decode credentials sent via HTTP Basic, so without <code>oauthClientAuthMethod</code>, sign-in fails with a <code>server responded with a challenge in the WWW-Authenticate HTTP Header</code> error. Trilium applies this automatically for <code>gitlab.com</code>, but a self-hosted issuer URL cannot be detected.</p></aside></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">Kanidm</p><div class=\"trilium-tab-panel\"><ol><li><p>Create the client, add the redirect URL and grant the scopes, replacing <code><server></code> with the URL of your Trilium instance and <code><group></code> with an existing Kanidm group whose members may sign in:</p><pre><code class=\"language-text-x-trilium-auto\">kanidm system oauth2 create trilium \"Trilium\" \"https://<server>\"\nkanidm system oauth2 add-redirect-url trilium \"https://<server>/callback\"\nkanidm system oauth2 update-scope-map trilium <group> openid profile email</code></pre><p>The <code>openid</code> scope is mandatory; without it Kanidm treats the client as plain OAuth 2.0.</p></li><li><p>Read the client secret:</p><pre><code class=\"language-text-x-trilium-auto\">kanidm system oauth2 show-basic-secret trilium</code></pre></li></ol><p>Adjust <code>config.ini</code> as follows, replacing <code><idm></code> with the URL of your Kanidm instance and <code><BasicSecret></code> with the value from step 2:</p><pre><code class=\"language-text-x-trilium-auto\">[MultiFactorAuthentication]\noauthBaseUrl=https://<server>\noauthClientId=trilium\noauthClientSecret=<BasicSecret>\noauthIssuerBaseUrl=https://<idm>/oauth2/openid/trilium\noauthIssuerName=Kanidm</code></pre><p>The client name you chose in step 1 is both the client ID and the last path segment of the issuer URL, so the two must match.</p><aside class=\"admonition important\"><p>Kanidm signs ID tokens with ES256, not RS256. Trilium detects this from the provider on v0.105.0 and later, so no extra configuration is needed. Do <strong>not</strong> run <code>kanidm system oauth2 warning-enable-legacy-crypto</code>, it downgrades the client to RS256 and disables ES256 entirely. On older Trilium versions sign-in fails with an <code>unexpected JWT alg</code> error.</p></aside></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">Pocket ID</p><div class=\"trilium-tab-panel\"><aside class=\"admonition important\"><p>Pocket ID is passwordless, signing in requires a passkey. Register one and confirm you can sign in to Pocket ID itself <em>before</em> switching Trilium over to OpenID Connect, otherwise you may find yourself unable to authenticate at either end.</p></aside><ol><li>Sign in to Pocket ID as an administrator and go to <em>OIDC Clients</em> → <em>Add OIDC Client</em>.</li><li>Give it a name (e.g. Trilium).</li><li>Set <em>Callback URLs</em> to <code>https://<server>/callback</code>, replacing <code><server></code> with the URL of your Trilium instance.</li><li>Save, then copy the <em>Client ID</em>, <em>Client Secret</em> and <em>OIDC Discovery URL</em>.</li></ol><p>Adjust <code>config.ini</code> as follows, using the values from step 4:</p><pre><code class=\"language-text-x-trilium-auto\">[MultiFactorAuthentication]\noauthBaseUrl=https://<server>\noauthClientId=<ClientID>\noauthClientSecret=<ClientSecret>\noauthIssuerBaseUrl=<OIDCDiscoveryURL>\noauthIssuerName=Pocket ID</code></pre><aside class=\"admonition note\"><p>Pocket ID gives you an <em>OIDC Discovery URL</em> ending in <code>/.well-known/openid-configuration</code>. On v0.105.0 and later you can paste it as-is. On earlier versions, remove that suffix and use only the part before it.</p></aside><aside class=\"admonition important\"><p>Pocket ID generates an RS256 signing key on first start, which works without further configuration. If you rotate it to Ed25519 (<code>pocket-id key-rotate --alg EdDSA --crv Ed25519</code>), ID tokens are signed with EdDSA instead. Trilium detects this automatically on v0.105.0 and later; older versions fail with <code>unexpected JWT alg received, expected RS256, got: EdDSA</code>.</p></aside></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><span style=\"--tn-color:#e64d4d;color:#e64d4d;\"><span class=\"tn-icon bx bx-x\"></span> GitHub</span></p><div class=\"trilium-tab-panel\"><p>GitHub cannot be used as an identity provider because it is plain OAuth 2.0 and not OpenID Connect, so it will fail with <code>OAUTH_RESPONSE_IS_NOT_CONFORM</code>.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><span class=\"tn-icon bx bxl-google\"></span> Google</p><div class=\"trilium-tab-panel\"><ol><li>Go to <a href=\"https://console.cloud.google.com/auth/clients\">Google Cloud's Clients</a> dashboard and select <em>Create client</em>.</li><li>For <em>Application type,</em> select <em>Web application</em>.</li><li>In <em>Authorized redirect URIs</em>, set <code>https://<server>/callback</code>.</li><li>Press <em>Create</em> and copy <em>Client ID</em> and <em>Client secret</em>.</li></ol><p>Adjust <code>config.ini</code> as follows, replacing <code><ClientID></code> and <code><ClientSecret></code> with the values from the last step as well as the <code><server></code> with a URL to your Trilium instance.</p><pre><code class=\"language-text-x-trilium-auto\">[MultiFactorAuthentication]\noauthBaseUrl=https://<server>\noauthClientId=<ClientID>\noauthClientSecret=<ClientSecret></code></pre></div></section></div>","_help_yeEaYqosGLSh": "<p>As an alternative to <a href=\"#root/_help_Dgg7bR3b6K9j\">hosting your own Trilium instance</a>, there are two services out there that provide out of the box support for Trilium.</p><aside class=\"admonition important\"><p><strong>Disclaimer</strong>: The Trilium Notes project and maintainers are not directly affiliated with either of the projects.</p><p>PikaPods have gracefully offered us free credits for testing purposes.</p></aside><h2>Cloud instance providers</h2><h3>PikaPods</h3><ol><li>Go to <a href=\"https://www.pikapods.com\">pikapods.com</a> and sign up.</li><li>In the “Available Apps” section, look for \"TriliumNext<br> and select “Run your own”.</li><li>Follow the on-screen instructions to set up your own cloud hosted instance.</li></ol><p>PikaPods generally updates their Trilium instances to the latest version within a two-week interval after a new version is released.</p><h2>Matching your version with the cloud instance</h2><p>Please note that once you set up <a class=\"reference-link\" href=\"#root/_help_cbkrhQjrkKrh\">Synchronization</a> between a cloud instance and <a href=\"#root/_help_poXkQfguuA0U\">desktop</a> clients, it's important that the version of the desktop application and the server match up.</p><p>When setting up a cloud instance, it's best to check the version of the server by accessing it via a web browser and going to the <em>About</em> section. It's best that both the desktop and the server have the same <em>App version</em>; however it's generally OK to update the desktop to a newer version than the server if it has the same <em>Sync version</em>.</p><p>If the <em>Sync version</em> between the server and the desktop application doesn't match, synchronization will not work.</p>",diff --git a/docs/User Guide/User Guide/Installation & Setup/Server Installation/Multi-factor authentication with TOTP.md b/docs/User Guide/User Guide/Installation & Setup/Server Installation/Multi-factor authentication with TOTP.mdindex 68eb32f1b3..06da0b3882 100644--- a/docs/User Guide/User Guide/Installation & Setup/Server Installation/Multi-factor authentication with TOTP.md+++ b/docs/User Guide/User Guide/Installation & Setup/Server Installation/Multi-factor authentication with TOTP.md@@ -21,7 +21,7 @@ TOTP (Time-Based One-Time Password) is a security feature that generates a uniqu## Connecting a device to the server-Once TOTP is enabled, connecting a new desktop or mobile app to the server through <a class="reference-link" href="../Synchronization.md">Synchronization</a> also asks for the second factor. On the _Connect to an existing server_ screen, enter a one-time password or a recovery code in _One-time password or recovery code_, next to the server's password. Without it, the server refuses to set up the sync.+Once TOTP is enabled, connecting a new desktop or mobile app to the server through <a class="reference-link" href="../Synchronization.md">Synchronization</a> also asks for the second factor. On the _Connect to an existing server_ screen, enter a one-time password or a recovery code in _One-time password or recovery code_, below the server's password. Without it, the server refuses to set up the sync.The second factor is only asked for when a device is first connected. A device that is already set up keeps syncing without it.