防止未经授权访问我的自定义应用程序

发布于 2024-12-20 19:18:58 字数 207 浏览 3 评论 0原文

我正在制作一个移动应用程序,并且创建了一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱桃奶球 2024-12-27 19:18:58

您需要在所有 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文