Facebook Open Graph 无需浏览器
对于具有互联网的中间件系统(在机顶盒内工作)我想要开发一个原始的 Facebook 界面,用户可以在其中输入用户名和密码,通过使用最近的 Facebook Graph API。
这个中间件程序使用 Java ME 来运行程序(例如这个简单的 facebook 应用程序),它可以连接到互联网,但它没有真正的 Web 浏览器。如果没有浏览器,它可以连接到任何 url 来检索 JSON 响应,但是我不确定如何在没有真正的浏览器的情况下实现身份验证。
这种情况下,是否可以进行Facebook认证呢?如果您这样认为,您会建议采取什么方法?
谢谢
For a middleware system with internet (which works inside a set-top box) I want to develop a primitive Facebook interface where users can type their user-names and password, showing their latest notification, messages and other casual stuff on the TV screen by using the recent Facebook Graph API.
This middleware program uses Java ME to run programs (such as this simple facebook app) and it can connect to internet however it doesn't have a real web browser. Without browser it can connect to any url to retrieve the JSON response however I am not sure how to achieve authentication without a real browser.
Under this circumstances, is it possible Facebook authentication? If you think so, what approach would you suggest ?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
Facebook 为值得信赖的合作伙伴提供私有授权 API,以从用户名/密码获取 OAuth 2 令牌。
更复杂的方法是执行类似于 Netflix 注册设备的方式:
Facebook provides trusted partners with a private Authorization API to get an OAuth 2 token from a username / password.
A more complicated approach would be doing something similar to how Netflix enrolls a device:
根据此文档“桌面应用程序身份验证”我不相信您想要的结果是可能的:
但是,某些供应商显然可以这样做,因为 Microsoft 的 Xbox 360 Facebook 应用程序完全符合您的建议。我很想知道是否有人挖出了任何 Facebook 在其最明显的文档中不想要的 API 来执行此操作。
According to this documentation on "Desktop Application Authentication" I don't believe your desired result is possible:
However, it is clearly possible for certain vendors to do this, since Microsoft's Xbox 360 Facebook application does exactly what you are proposing. I'd be interested to see if anyone has dug up any API for doing this that Facebook doesn't want in their most obvious documentation.
这不是答案,但我正在尝试做同样的事情。查看这个人的博客,它使用另一台服务器来代理请求:
cory wiles 博客
如果你明白了请在这里发布详细的答案,以便我可以做到..:)
This isn't an answer but I'm trying to do the same thing. Check out this guy's blog which uses another server to proxy the requests:
cory wiles blog
If you figure it out please post a detailed answer here so I can do it to.. :)
我认为这是可能的,尽管它相当复杂并且容易受到 Facebook 界面突然变化的影响。这可能会破坏您与 Facebook 之间的协议。
你所做的就是效仿Facebook。
您必须设置 Facebook 应用程序的一种方法。一旦获得用户的授权,您就可以使用 Graph API 进行某些操作。
您需要Facebook登录流程和授权流程。有一些针对http/https请求和响应的捕获工具。分析它们,包括标题和正文。
一旦了解了授权机制,您就可以用自己的机制替换它。接下来的一切都在 Graph API 上。
另一种途径是模拟 Facebook 登录、消息和通知流程。需要捕获和分析。
I think it is possible though it is pretty complicated and subject to sudden changes of Facebook interface. It might break the agreement between you and Facebook.
What you do is to emulate the Facebook.
One path you have to set up a Facebook application. Once you got the authorisation from user, you can to something with Graph API.
You need to the Facebook log-in process and authorisation process. There are some capturing tools on http/https request and response. Analyse them, both header and body.
Once you know the authorisation mechanism, you can replace it with you own. Everything afterward is on Graph API.
Another path is to emulate Facebook login and message and notification process. Capturing and analysis is needed.
过去我使用过一个名为 screen-scraper 的工具(全面披露:我曾经在那里工作)来自动化登录 Facebook。基本上,它模仿浏览器会话;它允许您设置会话变量(即用户名、密码),然后将其提交到 facebook,就像用户在浏览器中提交它们一样。
您可能无法在机顶盒环境中使用 screen-scraper(尽管它是基于 java 的,所以它可能会起作用)。即使没有,您也可以在 java 中实现类似的策略,使浏览器进行 HTTP 调用来加载登录页面并提交用户的凭据。为了保证用户信息的安全,请确保您使用的任何 HTTP 客户端库都支持 HTTPS。
代理工具和扩展,例如 Charles、Fiddler2、Firebug、Chrome 的开发工具等有助于准确了解浏览器在请求中向服务器发送的内容。
In the past I have used a tool called screen-scraper (full disclosure: I used to work there) to automate logging in to facebook. Basically, it imitates a browser session; it allows you to set session variables (i.e. username, password) which would then be submitted to facebook, just as if the user had submitted them in a browser.
You may not be able to use screen-scraper in your set-top box environment (although it is java-based, so it's possible it would work). Even if it doesn't, you could implement a similar strategy in java, making the HTTP calls a browser would make to load the login page and submit the user's credentials. To keep the user's info safe make sure whatever HTTP client library you use supports HTTPS.
Proxy tools and extensions like Charles, Fiddler2, Firebug, Chrome's dev tools, etc. are helpful in seeing exactly what the browser is sending to the server in requests.