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
docs(user): mention oauthClientAuthMethod
Elian Dorand16cab327206
diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Configuration (config.ini or environment variables).html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Configuration (config.ini or environment variables).htmlindex 1a7b19288a..82f32ca87c 100644--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Configuration (config.ini or environment variables).html+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Configuration (config.ini or environment variables).html@@ -12,9 +12,9 @@to lowest):</p><ol><li><strong>Environment variables</strong> (checked first)</li>- <li><strong>config.ini file values</strong>+ <li class="ck-list-marker-bold"><strong>config.ini file values</strong></li>- <li><strong>Default values</strong>+ <li class="ck-list-marker-bold"><strong>Default values</strong></li></ol><h2>Environment Variable Patterns</h2>@@ -227,62 +227,7 @@</table></figure><h3>MultiFactorAuthentication Section</h3>-<figure class="table">- <table>- <thead>- <tr>- <th>Environment Variable</th>- <th>Type</th>- <th>Default</th>- <th>Description</th>- </tr>- </thead>- <tbody>- <tr>- <td><code spellcheck="false">TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHBASEURL</code>- </td>- <td>string</td>- <td>""</td>- <td>OAuth/OpenID base URL</td>- </tr>- <tr>- <td><code spellcheck="false">TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTID</code>- </td>- <td>string</td>- <td>""</td>- <td>OAuth client ID</td>- </tr>- <tr>- <td><code spellcheck="false">TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTSECRET</code>- </td>- <td>string</td>- <td>""</td>- <td>OAuth client secret</td>- </tr>- <tr>- <td><code spellcheck="false">TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERBASEURL</code>- </td>- <td>string</td>- <td>"<a href="https://accounts.google.com">https://accounts.google.com</a>"</td>- <td>OAuth issuer base URL</td>- </tr>- <tr>- <td><code spellcheck="false">TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERNAME</code>- </td>- <td>string</td>- <td>"Google"</td>- <td>OAuth issuer display name</td>- </tr>- <tr>- <td><code spellcheck="false">TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERICON</code>- </td>- <td>string</td>- <td>""</td>- <td>OAuth issuer icon URL</td>- </tr>- </tbody>- </table>-</figure>+<p>See <a class="reference-link" href="#root/WOcw2SLH6tbX/_help_x1lQNKQBqLcA">Signing in with OpenID Connect</a>.</p><h3>Logging Section</h3><figure class="table"><table>diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect.htmlindex b807537546..fed2920794 100644--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect.html+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect.html@@ -26,8 +26,14 @@<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>+ class="table" style="width:101.29%;">+ <table class="ck-table-resized">+ <colgroup>+ <col style="width:11.67%;">+ <col style="width:23.7%;">+ <col style="width:29.4%;">+ <col style="width:35.23%;">+ </colgroup><thead><tr><th>Configuration</th>@@ -61,6 +67,17 @@</td><td>The client secret from your provider configuration.</td></tr>+ <tr>+ <td>Client auth method</td>+ <td><code spellcheck="false">oauthClientAuthMethod</code>+ </td>+ <td><code spellcheck="false">TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTAUTHMETHOD</code>+ </td>+ <td>Token-endpoint auth method: <code spellcheck="false">client_secret_basic</code> or+ <code+ spellcheck="false">client_secret_post</code>. Empty auto-detects. Only needed if sign-in+ fails with a <code spellcheck="false">WWW-Authenticate</code> or <code spellcheck="false">invalid_client</code> error.</td>+ </tr></tbody></table></figure>@@ -73,8 +90,15 @@spellcheck="false">oauthIssuerName</code>, and <code spellcheck="false">oauthIssuerIcon</code> inthe <code spellcheck="false">config.ini</code> file. Alternatively, thesevalues can be set using environment variables:</p>- <figure class="table">- <table>+ <figure class="table"+ style="width:106.63%;">+ <table class="ck-table-resized">+ <colgroup>+ <col style="width:11.08%;">+ <col style="width:22.5%;">+ <col style="width:27.93%;">+ <col style="width:38.49%;">+ </colgroup><thead><tr><th>Configuration</th>@@ -123,8 +147,9 @@spellcheck="false">TRILIUM_OAUTH_CLIENT_ID</code>, <code spellcheck="false">TRILIUM_OAUTH_CLIENT_SECRET</code>,and for customizing the provider: <code spellcheck="false">TRILIUM_OAUTH_ISSUER_BASE_URL</code>,<code- spellcheck="false">TRILIUM_OAUTH_ISSUER_NAME</code>, <code spellcheck="false">TRILIUM_OAUTH_ISSUER_ICON</code>- </p>+ spellcheck="false">TRILIUM_OAUTH_ISSUER_NAME</code>, <code spellcheck="false">TRILIUM_OAUTH_ISSUER_ICON</code>,+ <code+ spellcheck="false">TRILIUM_OAUTH_CLIENT_AUTH_METHOD</code>.</p></aside><h2>Connecting to the authentication provider</h2><p>Once the server has been configured at the previous step, the next step@@ -179,9 +204,19 @@<li>Restart the server for the changes to take effect.</li></ol><h2>Troubleshooting</h2>-<h3>Setup fails with “invalid user”</h3>+<h3>Setup fails with a <code spellcheck="false">WWW-Authenticate</code> or <code spellcheck="false">invalid_client</code> error</h3>+<p>Your provider disagrees with Trilium about how client credentials should+ be sent to the token endpoint. Set <code spellcheck="false">oauthClientAuthMethod</code> to+ <code+ spellcheck="false">client_secret_post</code>(or <code spellcheck="false">client_secret_basic</code> if+ it's already set to post) and restart. Providers vary: some reject+ <code+ spellcheck="false">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 spellcheck="false">invalid user</code></h3><p>If you are running behind a <a href="#root/_help_vcjrb3VVYPZI">reverse proxy</a>,- a buffer overflow can cause this issue. Here is a sample fix for + a buffer overflow can also cause this issue. Here is a sample fix for <aclass="reference-link" href="#root/_help_ud6MShXL4WpO">Nginx</a>: </p><pre><code class="language-text-x-trilium-auto">proxy_buffer_size 128k;proxy_buffers 4 256k;diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect/Setting up with various providers.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect/Setting up with various providers.htmlindex 5fa3d55832..37b483c7f7 100644--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect/Setting up with various providers.html+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect/Setting up with various providers.html@@ -1,43 +1,38 @@<h2>GitLab</h2><ol>- <li>- <p>Go to user settings on <a href="https://gitlab.com/-/user_settings/applications">gitlab.com</a> or- your own self-hosted instance.</p>- </li>- <li>- <p>Press <em>Add new application</em>.</p>- </li>- <li>- <p>Give it a name (e.g. Trilium).</p>- </li>- <li>- <p>Set <em>Redirect URI</em> to <code spellcheck="false">https://<server>/callback</code>- </p>- </li>- <li>- <p>Make sure <em>Confidential</em> is checked and <em>Device authorization grant</em> is- unchecked.</p>- </li>- <li>- <p>Under scopes, check <em>openid</em>, <em>profile</em> and <em>email</em> (they- should be near the end).</p>- </li>- <li>- <p>Save the application and copy the <em>Application ID</em> and <em>Secret</em>.</p>+ <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 spellcheck="false">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 spellcheck="false">config.ini</code> as follows, replacing<codespellcheck="false"><ApplicationId></code>and <code spellcheck="false"><Secret></code> withthe values from the last step as well as the <code spellcheck="false"><server></code> with- a URL to your Trilium instance. If you are using a self-hosted instance- of GitLab, make sure to also update <code spellcheck="false">oauthIssuerBaseUrl</code>.</p><pre><code class="language-text-x-trilium-auto">[MultiFactorAuthentication]+ a URL to your Trilium instance.</p><pre><code class="language-text-x-trilium-auto">[MultiFactorAuthentication]oauthBaseUrl=https://<server>-oauthClientId=<ApplicationId>-oauthClientSecret=<Secret>-oauthIssuerBaseUrl=https://gitlab.com--oauthIssuerName=GitLab</code></pre>\ No newline at end of file+oauthIssuerName=GitLab+oauthClientAuthMethod=client_secret_post+</code></pre>+<aside class="admonition important">+ <p>If you are using a self-hosted instance of GitLab, make sure to also update+ <code+ spellcheck="false">oauthIssuerBaseUrl</code>, and keep the <code spellcheck="false">oauthClientAuthMethod</code> line+ above.</p>+ <p>GitLab's token endpoint does not decode credentials sent via HTTP Basic,+ so without <code spellcheck="false">oauthClientAuthMethod</code>, sign-in+ fails with a <code spellcheck="false">server responded with a challenge in the WWW-Authenticate HTTP Header</code> error.+ Trilium applies this automatically for <code spellcheck="false">gitlab.com</code>,+ but a self-hosted issuer URL cannot be detected.</p>+</aside>+<p> </p>\ No newline at end of filediff --git a/docs/User Guide/!!!meta.json b/docs/User Guide/!!!meta.jsonindex 02c1c04e79..0d1269123c 100644--- a/docs/User Guide/!!!meta.json+++ b/docs/User Guide/!!!meta.json@@ -17845,6 +17845,13 @@"value": "bx bx-cog","isInheritable": false,"position": 30+ },+ {+ "type": "relation",+ "name": "internalLink",+ "value": "x1lQNKQBqLcA",+ "isInheritable": false,+ "position": 40}],"format": "markdown",diff --git a/docs/User Guide/User Guide/Advanced Usage/Configuration (config.ini or environment variables).md b/docs/User Guide/User Guide/Advanced Usage/Configuration (config.ini or environment variables).mdindex d376e84188..f63ca05c9a 100644--- a/docs/User Guide/User Guide/Advanced Usage/Configuration (config.ini or environment variables).md+++ b/docs/User Guide/User Guide/Advanced Usage/Configuration (config.ini or environment variables).md@@ -67,14 +67,7 @@ Additionally, shorter aliases are available for common configurations (see Alter### MultiFactorAuthentication Section-| Environment Variable | Type | Default | Description |-| --- | --- | --- | --- |-| `TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHBASEURL` | string | "" | OAuth/OpenID base URL |-| `TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTID` | string | "" | OAuth client ID |-| `TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTSECRET` | string | "" | OAuth client secret |-| `TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERBASEURL` | string | "[https://accounts.google.com](https://accounts.google.com)" | OAuth issuer base URL |-| `TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERNAME` | string | "Google" | OAuth issuer display name |-| `TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERICON` | string | "" | OAuth issuer icon URL |+See <a class="reference-link" href="../Installation%20%26%20Setup/Server%20Installation/Signing%20in%20with%20OpenID%20Connect.md">Signing in with OpenID Connect</a>.### Logging Sectiondiff --git a/docs/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect.md b/docs/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect.mdindex 74b7f69aac..0aa8dc2eed 100644--- a/docs/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect.md+++ b/docs/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect.md@@ -22,6 +22,7 @@ Setting up authentication with OpenID connect is a two-step process:| Base URL\* | `oauthBaseUrl` | `TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHBASEURL` | The URL of your Trilium instance (e.g. `https://example.com`). || Client ID\* | `oauthClientId` | `TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTID` | The client ID from your provider configuration. || Client Secret\* | `oauthClientSecret` | `TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTSECRET` | The client secret from your provider configuration. |+ | Client auth method | `oauthClientAuthMethod` | `TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTAUTHMETHOD` | Token-endpoint auth method: `client_secret_basic` or `client_secret_post`. Empty auto-detects. Only needed if sign-in fails with a `WWW-Authenticate` or `invalid_client` error. |Asterisk (\*) marks a required field3. The default OAuth issuer is Google. To use other services such as Authentik or Auth0, you can configure the settings via `oauthIssuerBaseUrl`, `oauthIssuerName`, and `oauthIssuerIcon` in the `config.ini` file. Alternatively, these values can be set using environment variables:@@ -36,7 +37,7 @@ Setting up authentication with OpenID connect is a two-step process:4. Restart the server so that the changes are applied.> [!NOTE]-> Legacy environment variables are also supported: `TRILIUM_OAUTH_BASE_URL`, `TRILIUM_OAUTH_CLIENT_ID`, `TRILIUM_OAUTH_CLIENT_SECRET`, and for customizing the provider: `TRILIUM_OAUTH_ISSUER_BASE_URL`, `TRILIUM_OAUTH_ISSUER_NAME`, `TRILIUM_OAUTH_ISSUER_ICON`+> Legacy environment variables are also supported: `TRILIUM_OAUTH_BASE_URL`, `TRILIUM_OAUTH_CLIENT_ID`, `TRILIUM_OAUTH_CLIENT_SECRET`, and for customizing the provider: `TRILIUM_OAUTH_ISSUER_BASE_URL`, `TRILIUM_OAUTH_ISSUER_NAME`, `TRILIUM_OAUTH_ISSUER_ICON`, `TRILIUM_OAUTH_CLIENT_AUTH_METHOD`.## Connecting to the authentication provider@@ -81,9 +82,13 @@ To disable the OpenID Connect authentication and instead rely on the local passw## Troubleshooting-### Setup fails with “invalid user”+### Setup fails with a `WWW-Authenticate` or `invalid_client` error-If you are running behind a [reverse proxy](2.%20Reverse%20proxy.md), a buffer overflow can cause this issue. Here is a sample fix for <a class="reference-link" href="2.%20Reverse%20proxy/Nginx.md">Nginx</a>:+Your provider disagrees with Trilium about how client credentials should be sent to the token endpoint. Set `oauthClientAuthMethod` to `client_secret_post` (or `client_secret_basic` if it's already set to post) and restart. Providers vary: some reject `client_secret_post` outright because the method is fixed when the client is registered (e.g. Authelia), so if one value doesn't work, try the other.++### Setup fails with `invalid user`++If you are running behind a [reverse proxy](2.%20Reverse%20proxy.md), a buffer overflow can also cause this issue. Here is a sample fix for <a class="reference-link" href="2.%20Reverse%20proxy/Nginx.md">Nginx</a>:```proxy_buffer_size 128k;diff --git a/docs/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect/Setting up with various providers.md b/docs/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect/Setting up with various providers.mdindex f5a98d7fca..225ae801e0 100644--- a/docs/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect/Setting up with various providers.md+++ b/docs/User Guide/User Guide/Installation & Setup/Server Installation/Signing in with OpenID Connect/Setting up with various providers.md@@ -9,7 +9,7 @@6. Under scopes, check _openid_, _profile_ and _email_ (they should be near the end).7. Save the application and copy the _Application ID_ and _Secret_.-Adjust `config.ini` as follows, replacing `<ApplicationId>` and `<Secret>` with the values from the last step as well as the `<server>` with a URL to your Trilium instance. If you are using a self-hosted instance of GitLab, make sure to also update `oauthIssuerBaseUrl`.+Adjust `config.ini` as follows, replacing `<ApplicationId>` and `<Secret>` with the values from the last step as well as the `<server>` with a URL to your Trilium instance.```[MultiFactorAuthentication]@@ -18,4 +18,11 @@ oauthClientId=<ApplicationId>oauthClientSecret=<Secret>oauthIssuerBaseUrl=https://gitlab.comoauthIssuerName=GitLab-```\ No newline at end of file+oauthClientAuthMethod=client_secret_post++```++> [!IMPORTANT]+> If you are using a self-hosted instance of GitLab, make sure to also update `oauthIssuerBaseUrl`, and keep the `oauthClientAuthMethod` line above.+>+> GitLab's token endpoint does not decode credentials sent via HTTP Basic, so without `oauthClientAuthMethod`, sign-in fails with a `server responded with a challenge in the WWW-Authenticate HTTP Header` error. Trilium applies this automatically for `gitlab.com`, but a self-hosted issuer URL cannot be detected.\ No newline at end of file