<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Brian Iyoha</title>
    <description>The latest articles on Forem by Brian Iyoha (@thecodearcher).</description>
    <link>https://forem.com/thecodearcher</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F74195%2F7930412e-3ffe-4203-82a4-a1fa15241cf3.png</url>
      <title>Forem: Brian Iyoha</title>
      <link>https://forem.com/thecodearcher</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/thecodearcher"/>
    <language>en</language>
    <item>
      <title>I couldn’t find Better Auth in Go, so I built one</title>
      <dc:creator>Brian Iyoha</dc:creator>
      <pubDate>Tue, 28 Apr 2026 20:26:35 +0000</pubDate>
      <link>https://forem.com/thecodearcher/i-couldnt-find-better-auth-in-go-so-i-built-one-4d75</link>
      <guid>https://forem.com/thecodearcher/i-couldnt-find-better-auth-in-go-so-i-built-one-4d75</guid>
      <description>&lt;p&gt;There’s been a noticeable shift in how authentication is approached in modern apps. Tools like &lt;a href="https://better-auth.com" rel="noopener noreferrer"&gt;Better Auth&lt;/a&gt; have pushed toward a model that is both developer-friendly and production-aware, with a strong emphasis on correctness, extensibility, and sensible defaults.&lt;/p&gt;

&lt;p&gt;But if you’re working in Go, that experience hasn’t really existed.&lt;/p&gt;

&lt;p&gt;That gap is what led to &lt;a href="https://limenauth.dev" rel="noopener noreferrer"&gt;Limen&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Limen is
&lt;/h2&gt;

&lt;p&gt;Limen is a composable authentication library for Go, designed to integrate directly into your application rather than sit beside it as a separate service.&lt;/p&gt;

&lt;p&gt;It is open source, publicly released, and available here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://limenauth.dev/" rel="noopener noreferrer"&gt;https://limenauth.dev&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/thecodearcher/limen" rel="noopener noreferrer"&gt;https://github.com/thecodearcher/limen&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is to make authentication easier to add to Go backends without forcing you into a specific framework or application structure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I built it
&lt;/h2&gt;

&lt;p&gt;Go has no shortage of authentication libraries. There are JWT helpers, OAuth clients, and frameworks that cover parts of the problem. But most of them fall into one of two categories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Low-level primitives that require significant assembly&lt;/li&gt;
&lt;li&gt;Opinionated frameworks that are hard to extend or adapt&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What’s often missing is a composable, production-ready system that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Handles sessions, cookies, and OAuth&lt;/li&gt;
&lt;li&gt;Lets you extend behavior without rewriting core logic&lt;/li&gt;
&lt;li&gt;Doesn’t force you into a specific router or framework&lt;/li&gt;
&lt;li&gt;Works with your existing database setup&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the space Better Auth occupies in the JavaScript ecosystem. The goal with Limen is not to replicate it exactly, but to bring that level of design and usability into Go.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Limen works
&lt;/h2&gt;

&lt;p&gt;Limen is built around a plugin-first approach.&lt;/p&gt;

&lt;p&gt;Instead of shipping every auth method as one large package, auth methods live as separate Go modules. You import the pieces you need and leave out the ones you do not.&lt;/p&gt;

&lt;p&gt;For example, a basic setup can use the core package, a database adapter, and the credential/password plugin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt; &lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;thecodearcher&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;limen&lt;/span&gt;
&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt; &lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;thecodearcher&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;limen&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;adapters&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;gorm&lt;/span&gt;
&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt; &lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;thecodearcher&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;limen&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;plugins&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;credential&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;password&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you configure Limen inside your Go app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;limen&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;limen&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Config&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;BaseURL&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;  &lt;span class="s"&gt;"http://localhost:8080"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Database&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;gormadapter&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;Plugins&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;limen&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Plugin&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;credentialpassword&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And mount it with your existing HTTP setup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;mux&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewServeMux&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;mux&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Handle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/api/auth/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Handler&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is the main idea: Limen should fit into your app, not dictate it.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What it supports today&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The first public release includes support for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Credential/password authentication&lt;/li&gt;
&lt;li&gt;10+ Social Sign-on providers (and growing)&lt;/li&gt;
&lt;li&gt;Two-factor authentication&lt;/li&gt;
&lt;li&gt;Session management&lt;/li&gt;
&lt;li&gt;Built-in rate limiting&lt;/li&gt;
&lt;li&gt;Database adapters&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It works with anything that speaks &lt;code&gt;http.Handler&lt;/code&gt;, including &lt;code&gt;net/http&lt;/code&gt;, Gin, Chi, and Echo.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Bring your own stack&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;One thing I wanted to avoid was building an auth system that assumes too much about the application around it.&lt;/p&gt;

&lt;p&gt;Limen is designed to work with your existing Go backend.&lt;/p&gt;

&lt;p&gt;You bring your own database. You bring your own framework. You choose the plugins you need.&lt;/p&gt;

&lt;p&gt;That makes it useful whether you are building a small API, a SaaS backend, or something more custom.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why not just use a hosted auth provider?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Hosted auth providers are great for many teams.&lt;/p&gt;

&lt;p&gt;But sometimes you want authentication to live inside your own application. Maybe you want more control over the data model. Maybe you want to keep your backend self-contained. Maybe you just prefer owning that part of your stack.&lt;/p&gt;

&lt;p&gt;Limen is for that kind of project.&lt;/p&gt;

&lt;p&gt;It gives you a foundation without making auth feel like a separate product bolted onto your app.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Current state&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Limen is ready to use today and still improving. That means the API will continue to evolve, the documentation will get better, and more plugins and adapters will be added over time.&lt;/p&gt;

&lt;p&gt;You can check it out here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://limenauth.dev" rel="noopener noreferrer"&gt;https://limenauth.dev&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/thecodearcher/limen" rel="noopener noreferrer"&gt;https://github.com/thecodearcher/limen&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>go</category>
      <category>webdev</category>
      <category>opensource</category>
      <category>authentication</category>
    </item>
    <item>
      <title>What really is the difference between session and token based authentication</title>
      <dc:creator>Brian Iyoha</dc:creator>
      <pubDate>Sun, 13 Jan 2019 00:05:04 +0000</pubDate>
      <link>https://forem.com/thecodearcher/what-really-is-the-difference-between-session-and-token-based-authentication-2o39</link>
      <guid>https://forem.com/thecodearcher/what-really-is-the-difference-between-session-and-token-based-authentication-2o39</guid>
      <description>&lt;p&gt;A friend who is just getting into using Nodejs for backend development asked me to explain the difference between using session and jwt. So I thought I’d write this for any other person trying to understand what it means when you hear other developers talk about sessions and token based authentication.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Introduction
&lt;/h2&gt;

&lt;p&gt;Firstly, let’s talk about the HTTP (HyperText Transfer Protocol). From a quick Google search we get that:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;HTTP is the underlying protocol used by the World Wide Web and this protocol defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;From the above definition, we can tell that HTTP is what enables communication between a client (frontend) and a server (backend). HTTP is stateless so each request made is totally unaware of any action taken previously. Say for example we just logged into our twitter account and we navigate to our settings page, with the default HTTP behavior, we would be required to log back in again because the server has no idea that we just logged in but with session and token authentication we can tell the server that we are already logged in and we have should be granted access to that page.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is session based authentication?
&lt;/h2&gt;

&lt;p&gt;Session based authentication is one in which the user state is stored on the server’s memory. When using a session based auth system, the server creates and stores the session data in the server memory when the user logs in and then stores the session Id in a cookie on the user browser.&lt;br&gt;
The session Id is then sent on subsequent requests to the server and the server compares it with the stored session data and proceeds to process the requested action.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F847f874qg86td1iqbeua.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F847f874qg86td1iqbeua.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is token based authentication?
&lt;/h2&gt;

&lt;p&gt;Token based authentication is one in which the user state is stored on the client. This has grown to be the preferred mode of authentication for RESTful APIs. In the token based authentication, the user data is encrypted into a JWT (JSON Web Token) with a secret and then sent back to the client.&lt;br&gt;
The JWT is then stored on the client side mostly localStorage and sent as a header for every subsequent request. The server receives and validates the JWT before proceeding to send a response to the client.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;headers:{
"Authorization": "Bearer ${JWT_TOKEN}"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;A typical example of how the token is sent with the header to the server
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2rd2py947i5yjzk95lu1.png"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When to use?
&lt;/h2&gt;

&lt;p&gt;There really isn’t a preferred method for authentication, both methods can be used interchangeably or together to create a hybrid system. It all boils down to the developer and the use case.&lt;br&gt;
However, it is worth noting that token based authentication scales better than that of a session because tokens are stored on the client side while session makes use of the server memory so it might become an issue when there is a large number of users using the system at once.&lt;/p&gt;

</description>
      <category>authentication</category>
      <category>webdev</category>
      <category>backend</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
