TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How would you implement auth for a self hosted product?

5 点作者 nopipeline12 个月前

8 条评论

stop5012 个月前
Try to implement as few of it in the application and offload the rest to keycloak
评论 #40721580 未加载
gtsteve12 个月前
I&#x27;d make it a pluggable middleware with a document on how to implement your own and provide a reference configuration that uses something like Vouch [0] which will redirect the user to another identity provider.<p>You could also provide another implementation that implements Cloudflare&#x27;s zero trust authentication [1].<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;vouch&#x2F;vouch-proxy">https:&#x2F;&#x2F;github.com&#x2F;vouch&#x2F;vouch-proxy</a><p>[1] <a href="https:&#x2F;&#x2F;developers.cloudflare.com&#x2F;cloudflare-one&#x2F;identity&#x2F;authorization-cookie&#x2F;validating-json&#x2F;" rel="nofollow">https:&#x2F;&#x2F;developers.cloudflare.com&#x2F;cloudflare-one&#x2F;identity&#x2F;au...</a><p>In other words, I don&#x27;t think I&#x27;d want to actually take responsibility for authentication these days and use an authenticating proxy. The less security infrastructure you have, the less there is to go out of date.<p>You can always start with this approach and then implement your own built-in user directory later.
lbhdc12 个月前
If I wasn&#x27;t using a framework that shipped with it already (like django), I would pick an authentication method that worked for what I am making. I would look for a well reviewed library in the language I am writing for both client and server.
codazoda12 个月前
You should consider HTTP Basic Auth. It’s a quick path to “good enough” and you can iterate to something better later. You can read more about why I started using it for my side projects on my blog post below.<p><a href="https:&#x2F;&#x2F;joeldare.com&#x2F;why-im-using-http-basic-auth-in-2022.html" rel="nofollow">https:&#x2F;&#x2F;joeldare.com&#x2F;why-im-using-http-basic-auth-in-2022.ht...</a>
XCSme11 个月前
I did it in the most basic way, I just store a cookie in PHP. I want to improve it a bit, by using session tokens (so you can get a unique token per device, and can revoke access if needed).
mffap12 个月前
Depends on what you need. If you look for SSO or a turnkey solution for auth, then maybe have a look at <a href="https:&#x2F;&#x2F;github.com&#x2F;zitadel&#x2F;zitadel">https:&#x2F;&#x2F;github.com&#x2F;zitadel&#x2F;zitadel</a><p>Check out the community chat, there are many people having implemented auth for self hosted setups that can share some insights.
aristofun12 个月前
I’ve already done it in nodejs and few lower level libs (cookies, encryption, oauth related).<p>Because nothing fit my needs and internal perfectionist.<p>Not a big deal if your requirements are narrow.<p>Its free, it fit your needs perfectly, it doesn’t waste your time on deployment and figuring out wtf is going on behind the scenes.
advaitruia12 个月前
Have you seen open source authentication products like SuperTokens or Keycloak?<p>Alternatively, you could use framework specific authentication libraries like nextjs or Devise (Ruby)