How to Hide an API Key in Client-Side Javascript

后端 未结 3 1625
有刺的猬
有刺的猬 2020-12-03 08:36

Right now I am writing a client-side javascript app that makes a request to the USPS Price Calculator API. In order to make this request, I need to provide my API User ID i

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-03 09:08

    In short: No, you can't secure your API key in a client-side app.

    This article goes into some more detail

    Two options

    • Make the API calls server-side and then serve information to the client from there
    • Require the client use their own API keys

提交回复
热议问题