How to secure the JavaScript API Access Token?

后端 未结 5 2041
轮回少年
轮回少年 2020-12-02 10:24

There are numerous online resources which provide JavaScript APIs to access their services. To be more clear, I will base my question on the example of MapBox, but this appl

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 11:02

    Javascript API tokens (and all client tokens, in fact) are always visible to the client (unless using them only server-side, as in node). There is no way around that. As you mentioned, the only way to truly secure an API key and keep it private is to store it in the server, then request the server to make the request on the client's behalf.

提交回复
热议问题