保护移动设备的 Web API
我们有一个用于本地搜索网站的 API,该 API 用于我们的移动应用程序。
目前,
- 该 API 不是公开的
- API 中未提供任何用户数据
- 通过 http 运行
我想保护通过 API 发送的数据。我做了一些研究,看起来 Oauth 是正确的方法
- Oauth 是正确的方法吗? (我们目前将使用 2 条腿的 oauth,但将来如果我们需要用户许可,我们将转向 3 条腿的 oauth)
- 我们的 API 需要 https 吗?自签名证书可以正常工作吗?
We have an API for our local search website, which is used on our Mobile Apps.
Currently,
- The API is not public
- No user data is provided in the API
- is running over http
I want to secure our data which is sent over the API. I have done some research, and looks like Oauth is the way to go
- Is Oauth the right way to do it? (we'll currently use 2 legged oauth but in future if we need user permission we'll move to 3 legged oauth)
- Do we need https for the API? Would a self signed certificate work fine?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Oauth 最适合涉及第三方(提供商)的场景。例如:使用 Facebook 登录。
如果用户必须登录您的服务才能访问 API,您可以使用基本身份验证。 (通过 Https 将凭据附加到 Http 标头)
最后:是的,您需要 Https。如果您控制客户端和服务器,自签名证书就可以工作。例如,对于 Android,您可以导入证书):
http://developer.android. com/training/articles/security-ssl.html(自签名服务器证书部分)
但是,如果您正在创建 Web 客户端,用户将收到不受信任站点的警告。
Oauth's best suited for scenarios that involve a third party (Provider). For example: sign in with Facebook.
If the user has to login to your service to access the API, you can use basic authentication. (Attach credentials to Http header over Https)
Finally: Yes you need Https. And a self-signed certificate can work if you control the client and the server. For example for Android you can import your certificates):
http://developer.android.com/training/articles/security-ssl.html (Self-signed server certificate section)
However, if you are creating a web client, user would get a warning for untrusted site.