php - 保护对 PHP API 的访问

标签 php iphone api rest hash

我有一个 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/

相关文章:

php - Yii2 以编程方式迁移命令

php - 如何针对大数据更新和多个 API 调用优化 cron 和 PHP 脚本

java - Stripes 1.5 - 有什么方法可以向系统询问所有 ActionBean 的列表吗?

node.js - 如何同步处理 api 请求,每个请求等待几秒钟

php - CKEDITOR 没有设置来自数据库的文本样式

php - 使用 Xpath 获取第一个祖先

iphone - 何时捕获 UILabel 的高度?

iphone - 这意味着什么? "mi_cmd_stack_list_frames: Not enough frames in stack."

iphone - 以编程方式强制 UIScrollView 停止滚动,以便与多个数据源共享 TableView

php - Codeigniter 需要从一个模块连接到另一个模块