Struggling with Auth in Go + Next.js? Let’s Chat!

Hey folks, I’m working on a front-end project with Go and Next.js, and I’ve hit a snag with Authentication and Authorization. Everything else is set, but I’m stuck on figuring out a clean, simple way to handle auth.

I’ve been diving into open-source options, but every time I look for advice, it’s all about third-party services like Auth0, Firebase, or Okta. Sure, they’re convenient, but seriously, why isn’t there an open-source solution that makes implementing auth super easy? Back when I used to work with Laravel and Symfony, it was all built-in. Everything was just there, ready to roll. You could see the encrypted password right next to the username in the user table, no fuss.

So, is there no simple plug-and-play solution for Auth in other stacks like Go/Next.js? Is it really that hard to implement without leaning on third-party providers, or am I just overlooking something here? I’d love to hear what you all think, especially if you’ve faced similar headaches.

5 Likes

It’s tough because hackers are always finding new ways in. If it weren’t for them, this would be a lot simpler. The challenge is creating something secure enough to keep them out, but still easy for the right user to access—it’s like solving a really complex puzzle. On top of that, you’ve got to account for users forgetting passwords, leaving sessions open on public computers, and making other mistakes. One slip-up, and your users are vulnerable. Solving all these issues together is no easy task.

4 Likes

If you handle auth in-house, you’re taking on the full responsibility of securing that system. If there’s a breach, you’ll be the one accountable for notifying users and dealing with the fallout.

I used to manage my own auth, and while OAuth can be tricky, relying on a bigger company for security is honestly a huge weight off my shoulders.

3 Likes

It’s one of those tasks that people don’t deal with often, so when it comes time to set it up, no one’s really an expert. If you’re the “web guy” at some organization, you might set it up once for the company’s website or maybe a couple of other properties, but that’s about it. It’s not much easier at an agency either, because even if you’re setting it up for multiple clients, you’re usually dealing with different identity providers each time. Plus, you rarely get full access to the client’s side, so you’re stuck coordinating with their IT team to set up the endpoints.

I’ve worked with SimpleSamlPHP on a few projects, and even now, it’s still a headache. Sometimes I think it might make sense to freelance as an authentication specialist—just consulting on auth flows for different projects. Every setup is different, and you usually have to map attributes in claims to specific values on the user account in your service provider anyway. It’s a lot to juggle.

2 Likes

I suppose the real question is why framework authors haven’t picked a single solution to integrate into their frameworks.

Perhaps the community prefers having options, or maybe the authors think it’s better to simply recommend certain packages rather than bake them into the framework itself. On the flip side, NestJS did make a definitive choice by opting for JWT and Passport as its authentication solutions. You can check out how NestJS has implemented authentication and authorization in their documentation section.

1 Like

While hackers are crafty and there are certainly poor implementations out there, that’s not the main reason security can be tricky. The real issue lies with the intelligence of your users.

Implementing simple measures like checking for password complexity, hashing and salting passwords, and securely storing them in your database can go a long way. If users are sensible and choose unique passwords that aren’t easily compromised, you’re in a good place.

Unfortunately, most people still make foolish choices, like using passwords such as:

Password1, Password2, Password3

When their credentials inevitably leak, anyone can take that email and password combo and brute-force it against multiple systems to see what works.

Even with the availability of password managers, many people cling to their trusty Password1 and Password2 combinations. To make matters worse, there are scams where individuals share their passwords openly or joke about their weak credentials.

You might think that older generations are the worst offenders, but surprisingly, it’s often younger people who are more guilty of this.

The bigger issue arises when these users get compromised and then blame you for their own lack of caution. This pressure forces us into implementing multi-factor authentication, OAuth, device verification, and eventually leads to a complex web of authentication systems that only complicates development.