我有一个 iPhone 应用程序在服务器上使用我的 php api,但如果有人知道 url,它目前是打开的。我想确保没有人可以使用这个 API,直到我准备好将它变成一个公共(public) API(如果我这样做的话)
我已阅读 this article但我不确定他们说的是什么意思:
[CLIENT] Before making the REST API call, combine a bunch of unique data together (this is typically all the parameters and values you intend on sending, it is the “data” argument in the code snippets on AWS’s site)
我不明白如果我散列我计划用我的 api secret 发送的参数,如果我发送未加密的参数/值,这比仅仅散列 api secret 更安全。
最佳答案
HTTPS API 并使用 API key 。然后您就会知道只有拥有 key 的人(在本例中为您)才能访问 API。
您说的不是更安全是对的。这就是为什么我建议您使用 SSL 连接。除非您计划对来回传输的所有内容进行加密。
公钥/私钥方案也可以正常工作。 HTTPS 需要非常最少的努力。
关于php - 保护对 PHP API 的访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11350989/