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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: How do you approach service-to-service authentication?

1 点作者 posix_monad11 个月前
Services often need to talk to each-other, but how should they control access?<p>In an ideal world, callers can prove who they are to services and services only grant access to a minimal set of consumers. There should be low boiler-plate for maintaining service identities and things like token revocation, secret rotation, etc. should be &quot;easy&quot;. Bonus points for avoiding vendor lock-in.<p>What approach do you use for securing service-to-service access?

2 条评论

taylodl11 个月前
If both services are created and managed by you then you have these possibilities:<p>- API Key (quick &amp; easy with <i>reasonable</i> security)<p>- OIDC (OAuth) (client now &quot;pretends&quot; to be a user, <i>or</i> acts on behalf of a user)<p>- Client Key Authentication (can be quick &amp; easy if you have infrastructure in place)<p>All three approaches suffer from a common problem: secrets management. When using an API Key, it&#x27;s the API Key itself that&#x27;s the secret needing to be managed. When using OIDC the password is the secret needing to be managed. When using Client Key Authentication the client key is the secret needing to be managed.<p>Generally-speaking, you don&#x27;t want to put your secret into your codebase and check it into git (or whatever source control system you&#x27;re using).<p>How you manage these secrets depends on what platform you&#x27;re on, and the languages and frameworks you&#x27;re using or even whether your organization has setup a secrets vault. There&#x27;s a dizzying number of options for managing secrets. Regardless of which route you go with managing secrets; these are the three main strategies you can use for securing your APIs.
soloist1111 个月前
The standard solution is to use digital keys and signatures. There is no need to reinvent the wheel here, just use the standard cryptographic constructions to verify that the requests are from trusted sources, e.g. <a href="https:&#x2F;&#x2F;medium.com&#x2F;@georgwiese&#x2F;hash-based-digital-signatures-almost-from-scratch-da57e54dd774" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@georgwiese&#x2F;hash-based-digital-signatures...</a>
评论 #40848131 未加载