Skip to content

Build your personal knowledge base with Trilium Notes

docs(user): mention Authelia & GitHub

Elian Doranf19710096d64
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.html
index fed2920794..6f037b04ce 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
@@ -220,4 +220,8 @@
<a
class="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;
-proxy_busy_buffers_size 256k;</code></pre>
\ No newline at end of file
+proxy_busy_buffers_size 256k;</code></pre>
+<h3>Setup fails with <code spellcheck="false">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>
\ No newline at end of file
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.html
index 37b483c7f7..7e67f4a73d 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,4 +1,75 @@
-<h2>GitLab</h2>
+<aside class="admonition note">
+ <p>This page contains instructions on how to set up&nbsp;<a class="reference-link"
+ href="#root/pOsGYCXsbNQG/Otzi9La2YAUX/WOcw2SLH6tbX/_help_x1lQNKQBqLcA">Signing in with OpenID Connect</a>&nbsp;with
+ various providers such as Authelia, GitLab,. Google. Note that 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>
+<h2>Authelia</h2>
+<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
+</code></pre>
+ <p><code spellcheck="false">Random Password</code> goes to Trilium, <code spellcheck="false">Digest</code> (the
+ <code
+ spellcheck="false">$pbkdf2-sha512$…</code>string) goes to Authelia.</p>
+ </li>
+ <li>
+ <p>Add a client under <code spellcheck="false">identity_providers.oidc.clients</code> in
+ Authelia's <code spellcheck="false">configuration.yml</code>, replacing
+ <code
+ spellcheck="false">&lt;server&gt;</code>with the URL of your Trilium instance:</p><pre><code class="language-text-x-yaml">identity_providers:
+
+ oidc:
+
+ clients:
+
+ - client_id: 'trilium'
+
+ client_name: 'Trilium'
+
+ client_secret: '&lt;Digest&gt;'
+
+ public: false
+
+ authorization_policy: 'two_factor'
+
+ redirect_uris:
+
+ - 'https://&lt;server&gt;/callback'
+
+ scopes:
+
+ - 'openid'
+
+ - 'profile'
+
+ - 'email'</code></pre>
+ <p>Unlike GitLab, <code spellcheck="false">client_id</code> is a name you choose
+ rather than one the provider generates.</p>
+ </li>
+ <li>Restart Authelia.</li>
+</ol>
+<p>Adjust <code spellcheck="false">config.ini</code>, using the <code spellcheck="false">Random Password</code> from
+ step 1:</p><pre><code class="language-text-x-trilium-auto">[MultiFactorAuthentication]
+
+oauthBaseUrl=https://&lt;server&gt;
+
+oauthClientId=&lt;ClientId&gt;
+
+oauthClientSecret=&lt;RandomPassword&gt;
+
+oauthIssuerBaseUrl=https://&lt;server&gt;
+
+oauthIssuerName=Authelia</code></pre>
+<aside class="admonition important">
+ <p>Do <strong>not</strong> set <code spellcheck="false">oauthClientAuthMethod</code> for
+ Authelia. It defaults confidential clients to <code spellcheck="false">client_secret_basic</code> and
+ rejects any other method with <code spellcheck="false">invalid_client</code>,
+ which is the default Trilium already uses. This is the opposite of the
+ GitLab case below.</p>
+</aside>
+<h2>GitLab (self-hosted or cloud)</h2>
<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>
@@ -35,4 +106,33 @@ oauthClientAuthMethod=client_secret_post
Trilium applies this automatically for <code spellcheck="false">gitlab.com</code>,
but a self-hosted issuer URL cannot be detected.</p>
</aside>
-<p>&nbsp;</p>
\ No newline at end of file
+<h2>GitHub</h2>
+<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 spellcheck="false">OAUTH_RESPONSE_IS_NOT_CONFORM</code>.</p>
+<h2>Google</h2>
+<ol>
+ <li>
+ <p>Go to <a href="https://console.cloud.google.com/auth/clients">Google Cloud's Clients</a> dashboard
+ and select <em>Create client</em>.</p>
+ </li>
+ <li>
+ <p>For <em>Application type,</em> select <em>Web application</em>.</p>
+ </li>
+ <li>
+ <p>In <em>Authorized redirect URIs</em>, set &nbsp;<code spellcheck="false">https://&lt;server&gt;/callback</code>.</p>
+ </li>
+ <li>
+ <p>Press <em>Create</em> and copy <em>Client ID</em> and <em>Client secret</em>.</p>
+ </li>
+</ol>
+<p>Adjust <code spellcheck="false">config.ini</code> as follows, replacing
+ <code
+ spellcheck="false">&lt;ClientID&gt;</code>and <code spellcheck="false">&lt;ClientSecret&gt;</code> with
+ the values from the last step as well as the <code spellcheck="false">&lt;server&gt;</code> with
+ a URL to your Trilium instance.</p><pre><code class="language-text-x-trilium-auto">[MultiFactorAuthentication]
+
+oauthBaseUrl=https://&lt;server&gt;
+
+oauthClientId=&lt;ClientID&gt;
+
+oauthClientSecret=&lt;ClientSecret&gt;</code></pre>
\ No newline at end of file
diff --git a/docs/User Guide/!!!meta.json b/docs/User Guide/!!!meta.json
index 0d1269123c..936ba33632 100644
--- a/docs/User Guide/!!!meta.json
+++ b/docs/User Guide/!!!meta.json
@@ -1648,6 +1648,13 @@
"value": "setup",
"isInheritable": false,
"position": 30
+ },
+ {
+ "type": "relation",
+ "name": "internalLink",
+ "value": "x1lQNKQBqLcA",
+ "isInheritable": false,
+ "position": 40
}
],
"format": "markdown",
diff --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.md
index 0aa8dc2eed..219b5d554a 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
@@ -94,4 +94,8 @@ If you are running behind a [reverse proxy](2.%20Reverse%20proxy.md), a buffer o
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
-```
\ No newline at end of file
+```
+
+### Setup fails with `OAUTH_RESPONSE_IS_NOT_CONFORM`
+
+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.
\ No newline at end of file
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.md
index 225ae801e0..3301354dcd 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
@@ -1,5 +1,54 @@
# Setting up with various providers
-## GitLab
+> [!NOTE]
+> This page contains instructions on how to set up <a class="reference-link" href="../Signing%20in%20with%20OpenID%20Connect.md">Signing in with OpenID Connect</a> with various providers such as Authelia, GitLab,. Google. Note that 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.
+
+## Authelia
+
+1. Generate a client secret:
+
+ ```
+ authelia crypto hash generate pbkdf2 --variant sha512 --random --random.length 72 --random.charset rfc3986
+
+ ```
+
+ `Random Password` goes to Trilium, `Digest` (the `$pbkdf2-sha512$…` string) goes to Authelia.
+2. Add a client under `identity_providers.oidc.clients` in Authelia's `configuration.yml`, replacing `<server>` with the URL of your Trilium instance:
+
+ ```yaml
+ identity_providers:
+ oidc:
+ clients:
+ - client_id: 'trilium'
+ client_name: 'Trilium'
+ client_secret: '<Digest>'
+ public: false
+ authorization_policy: 'two_factor'
+ redirect_uris:
+ - 'https://<server>/callback'
+ scopes:
+ - 'openid'
+ - 'profile'
+ - 'email'
+ ```
+
+ Unlike GitLab, `client_id` is a name you choose rather than one the provider generates.
+3. Restart Authelia.
+
+Adjust `config.ini`, using the `Random Password` from step 1:
+
+```
+[MultiFactorAuthentication]
+oauthBaseUrl=https://<server>
+oauthClientId=<ClientId>
+oauthClientSecret=<RandomPassword>
+oauthIssuerBaseUrl=https://<server>
+oauthIssuerName=Authelia
+```
+
+> [!IMPORTANT]
+> Do **not** set `oauthClientAuthMethod` for Authelia. It defaults confidential clients to `client_secret_basic` and rejects any other method with `invalid_client`, which is the default Trilium already uses. This is the opposite of the GitLab case below.
+
+## GitLab (self-hosted or cloud)
1. Go to user settings on [gitlab.com](https://gitlab.com/-/user_settings/applications) or your own self-hosted instance.
2. Press _Add new application_.
@@ -25,4 +74,24 @@ 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
+> 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.
+
+## GitHub
+
+GitHub cannot be used as an identity provider because it is plain OAuth 2.0 and not OpenID Connect, so it will fail with `OAUTH_RESPONSE_IS_NOT_CONFORM`.
+
+## Google
+
+1. Go to [Google Cloud's Clients](https://console.cloud.google.com/auth/clients) dashboard and select _Create client_.
+2. For _Application type,_ select _Web application_.
+3. In _Authorized redirect URIs_, set  `https://<server>/callback`.
+4. Press _Create_ and copy _Client ID_ and _Client secret_.
+
+Adjust `config.ini` as follows, replacing `<ClientID>` and `<ClientSecret>` with the values from the last step as well as the `<server>` with a URL to your Trilium instance.
+
+```
+[MultiFactorAuthentication]
+oauthBaseUrl=https://<server>
+oauthClientId=<ClientID>
+oauthClientSecret=<ClientSecret>
+```
\ No newline at end of file