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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: Securing third-party API keys within frontend in 2019

3 点作者 somada141超过 5 年前
Hi all,<p>I&#x27;ve only been working with frontend for a few months and one thing that has me stumped is handling third-party secrets required by the app, e.g. access-tokens or API keys required for interaction with MapBox [0] or Sentry [1]. I&#x27;m only referring to client-side JS, where to my understanding any bundled secret is effectively compromised, as opposed to server-side rendered websites<p>While the most secure solution I&#x27;ve come across seems to be about having the frontend communicate with these services via a proxy, e.g., Nginx proxying requests to those services after validating the JWT token Auth0 [2] issues to the frontend client, this solution seems to be poorly supported. For example only Nginx Plus appears to support JWT validation.<p>Thus I&#x27;m truly curious, how do you secure your third-party secrets needed by your frontend in 2019?<p>[0] https:&#x2F;&#x2F;www.mapbox.com&#x2F; [1] https:&#x2F;&#x2F;sentry.io [2] https:&#x2F;&#x2F;auth0.com&#x2F;

1 comment

phillipseamore超过 5 年前
Usually an API key that is supposed to be used on the frontend would be locked down to a domain (checking the Origin or referrer header). Otherwise you are expected to either have your own service that communicates with the API or proxy it. IIRC there are some modules for nginx for JWT validation though that&#x27;s not something you would need, you could check the headers as above.
评论 #20900510 未加载