防止未经授权访问我的自定义应用程序
我正在制作一个移动应用程序,并且创建了一个 API 来将 JSON 数据发送到该应用程序。问题是,如果我们使用 www.domainname.com/example.php?listid=1
调用 API,这将带来 id 为 1 的所有列表信息。我遇到的问题是计算了解如何防止未经授权的用户访问 API。我希望用户只能查看他们创建的列表。
我正在使用 PHP
I am making a mobile application, and I have created an API to send JSON data to the app. The thing is if we called the API with www.domainname.com/example.php?listid=1
this will bring all the list information that has the id of 1. The issue I am having is figuring out how I can prevent an unauthorized user from accessing the API. I want the users to only be able to view the lists that they have created.
I am using PHP
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在所有 API 请求中包含安全身份验证令牌。
(并在服务器上验证它)
您可能还应该使用 SSL。
You need to include a secure authentication token with all API requests.
(and validate it on the server)
You should probably also use SSL.