如何安全地使用FB.Event.Subscribe调用webservice
我正在考虑使用 FB.event.subscribe 方法来在有人在 FB 评论插件中留下评论时收到通知。
但是,我想使用 Ajax 调用我在服务器上公开的 Web 服务,以跟踪 (a) 评论了什么 (b) 谁留下了评论。
我有以下问题,希望得到一些帮助:
- FB.event.subscribe 为我的函数提供了哪些信息? FB 文档完全贫乏并且没有提供足够的信息细节。例如,我想知道谁发表了评论。
- 如果我调用 Web 服务,比如在数据库中插入一行来跟踪评论,例如评论是什么以及留下的日期时间。如果我使用 Ajax 来调用 Web 服务,如何安全地执行?由于它是 ajax,任何人都可以查看源代码并查看我正在调用的端点。我无法使用令牌,因为它已公开。
I'm looking at using the FB.event.subscribe method to get a notification whenever someone leaves a comment in the FB comment plugin.
However, I want to use Ajax to call a webservice I've exposed on my server to keep track of (a) What was commented on (b) who left the comment.
I have the following questions and was hoping to get some help:
- Does the what information does the FB.event.subscribe give me to my function? The FB documentation is totally anemic and doesn't give enough detail. For example, I want to know WHO left the comment.
- If I call a webservice, say to insert a row in my DB to keep track of comments, such as what the comment is and what datetime it was left. If I use Ajax to just call a web service, how do I do it securely? Since it's ajax, anyone can view source and see the endpoint I'm calling. I can't use a token since that's exposed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题1的回答:
您可以执行以下代码片段来了解当 Firebug 的控制台窗口打开时从 facebook api 获得的内容。
回答问题2:
您可能需要实现自己的安全机制来保护您拥有的 Web 服务。这可以通过在调用时检查令牌或其他任何事情来完成。
Answer to question 1:
You can do below snippet to find out what you get from facebook api while firebug's console window is opening.
Answer to question 2:
You might need to implement your own security mechanism to secure the webservice you have. It can be done by checking a token when it be called or whatever something else.