Menu

1 / 2

Why I stopped rolling my own auth and switched to Keycloak

DEV Community·fenixkit·6 months ago
#BxhvgTmx
#keycloak#dotnet#token#auth#article
Reading 0:00
15s threshold

Every developer has built it at least once. A UsersController , a POST /auth/login endpoint, a PasswordHasher , a JwtService that generates tokens. It feels like the natural thing to do — auth is just another feature, right?

It isn't. And I learned that the hard way.

What "rolling your own JWT auth" actually means

On the surface it looks simple:

var token = new JwtSecurityToken ( issuer : "myapp" , claims : claims , expires : DateTime . UtcNow . AddHours ( 1 ), signingCredentials : credentials );

Enter fullscreen mode

Exit fullscreen mode

But that's just the token. The moment you decide to own your auth stack, you're signing up for all of this:

Password storage — hashing, salting, choosing the right algorithm (bcrypt? Argon2?…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.