<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Remark42 on Janik von Rotz</title>
    <link>https://janikvonrotz.ch/tags/remark42/</link>
    <description>Recent content in Remark42 on Janik von Rotz</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Wed, 12 Aug 2026 17:32:22 +0000</lastBuildDate>
    <atom:link href="https://janikvonrotz.ch/tags/remark42/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Remark42 Authenticate with Codeberg</title>
      <link>https://janikvonrotz.ch/2026/08/12/remark42-authenticate-with-codeberg/</link>
      <pubDate>Wed, 12 Aug 2026 17:32:22 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2026/08/12/remark42-authenticate-with-codeberg/</guid>
      <description>&lt;p&gt;At then end of each post you can leave a comment. This comment section is powered by &lt;a href=&#34;https://remark42.com/&#34;&gt;Remark42&lt;/a&gt;. A highly recommended comment engine. But be aware, there is no SaaS and you have to host it yourself (maybe that is way it is so good). For quite some time the only option to authenticate on my site was using &lt;em&gt;GitHub&lt;/em&gt;. As a proud member for Codeberg this had to change.&lt;/p&gt;&#xA;&lt;p&gt;Before we start I wanna thank my brother. I already &lt;a href=&#34;https://joelvonrotz.ch/writing/codeberg-as-a-remark42-authenticator/&#34;&gt;made the integration&lt;/a&gt; and so it was easier for me to do this as well.&lt;/p&gt;&#xA;&lt;h2 id=&#34;setup-codeberg-oauth2&#34;&gt;Setup Codeberg OAuth2&lt;/h2&gt;&#xA;&lt;p&gt;First we create the OAuth2 application in Coderberg. Open &lt;a href=&#34;https://codeberg.org/user/settings/applications&#34;&gt;https://codeberg.org/user/settings/applications&lt;/a&gt; and log in. Underneath &lt;em&gt;Manage OAuth2 applications&lt;/em&gt; enter &lt;code&gt;Remark42&lt;/code&gt; as name, &lt;code&gt;&amp;lt;url-of-your-remark42-instance&amp;gt;/auth/codeberg/callback&lt;/code&gt; as &lt;em&gt;Redirect URI&lt;/em&gt; and click &lt;em&gt;Create application&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In the new dialog copy the &lt;em&gt;Client ID&lt;/em&gt; and the &lt;em&gt;Client Secret&lt;/em&gt;. We will need this in the second step.&lt;/p&gt;&#xA;&lt;h2 id=&#34;deploy-remark42&#34;&gt;Deploy Remark42&lt;/h2&gt;&#xA;&lt;p&gt;The PR that supports authentication with OAuth provider was merged only recently: &lt;a href=&#34;https://github.com/umputun/remark42/pull/2006&#34;&gt;https://github.com/umputun/remark42/pull/2006&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The documentation shows the new environment variables that need to be configured: &lt;a href=&#34;https://remark42.com/docs/configuration/authorization/#custom-oauth2-provider&#34;&gt;https://remark42.com/docs/configuration/authorization/#custom-oauth2-provider&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am deploying Remark42 using this &lt;a href=&#34;https://ansible.build/roles/remark42/&#34;&gt;https://ansible.build/roles/remark42/&lt;/a&gt; Ansible role. Adding support for new env vars is fairly simple for Ansible roles. You only need to map the env vars to Ansible vars.&lt;/p&gt;&#xA;&lt;p&gt;I updated the role and in my Ansible inventory I made this configuration:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;remark42_image&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;umputun/remark42:v1.16.4&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;remark42_auth_custom_name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;codeberg&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;remark42_auth_custom_cid&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;lt;client id goes here&amp;gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;remark42_auth_custom_auth_url&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;https://codeberg.org/login/oauth/authorize&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;remark42_auth_custom_token_url&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;https://codeberg.org/login/oauth/access_token&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;remark42_auth_custom_info_url&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;https://codeberg.org/login/oauth/userinfo&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;remark42_auth_custom_scopes&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;read:user&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;em&gt;Client Secret&lt;/em&gt; was encrypted with Ansible vault and stored as &lt;code&gt;vault_remark42_auth_custom_csec&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;After deploying the container with Ansible I checked the log:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-txt&#34; data-lang=&#34;txt&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2026/08/12 12:31:24.692 [INFO]  init oauth2 service github&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2026/08/12 12:31:24.693 [INFO]  init oauth2 service codeberg&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Everthing looked fine.&lt;/p&gt;&#xA;&lt;h2 id=&#34;testing&#34;&gt;Testing&lt;/h2&gt;&#xA;&lt;p&gt;After the deployment I opened my site in private tab and clicked &lt;em&gt;Sign In&lt;/em&gt; on a random post:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://janikvonrotz.ch/images/remark42-sign-in.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then I clicked on &lt;em&gt;Codeberg&lt;/em&gt; and was redirected. After login I got this error:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Authorization failed&lt;br&gt;&#xA;Unregistered Redirect URI&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I double checked the redirect uri, but it was definitely correct. I took me a while to figure this out. Basically I messed up the client id and secret and then I forgot to remove the placeholder in the host inventory:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;remark42_auth_custom_csec: # default&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;{{ vault_remark42_auth_custom_csec }}&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once fixed this I got greeted by this message:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Authorize &amp;ldquo;Remark42&amp;rdquo; to access your account?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Clicked &lt;em&gt;Accept&lt;/em&gt; and was redirected and welcomed by a new error message:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;error&amp;#34;&lt;/span&gt;:&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;exchange failed&amp;#34;&lt;/span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In Ansible I quoted the &lt;code&gt;AUTH_CUSTOM_CSEC&lt;/code&gt; env var. This was a mistake. After removing the quotes it worked! Yay!&lt;/p&gt;&#xA;&lt;h2 id=&#34;cleanup-step&#34;&gt;Cleanup step&lt;/h2&gt;&#xA;&lt;p&gt;On last thing that bothered me was that my Codeberg user did not have admin rights. To grant admin access you set the &lt;code&gt;ADMIN_SHARED_EMAIL&lt;/code&gt; and &lt;code&gt;ADMIN_SHARED_ID&lt;/code&gt;. The email stayed the same, but the id changes. To retrieve the id you click on the username in the login section. Then I added this is to the env var. After refresh I saw the admin settings in the comment section.&lt;/p&gt;&#xA;&lt;p&gt;Read more at &lt;a href=&#34;https://remark42.com/docs/configuration/parameters/#admin-users&#34;&gt;https://remark42.com/docs/configuration/parameters/#admin-users&lt;/a&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
