如何仅使用桌面应用程序登录 Facebook 并获取 Java 访问 token ?
我找到了一个api http://restfb.com它允许您调用方法,但您必须自己获取 token 。那么有没有办法只使用桌面应用程序来做到这一点呢?也许将浏览器嵌入到弹出窗口中?
我已经知道获取 token 的过程在这里解释http://benbiddington.wordpress.com/2010/04/23/facebook-graph-api-getting-access-tokens所以我的问题不涉及这个。我需要一种让用户使用某种 GUI 登录 Facebook 的方法。
最佳答案
如 Facebook 文档中所示
Our OAuth 2.0 implementation does not include explicit support for application built for desktop operating systems. However, if your app can embed a web browser (most desktop frameworks such as .NET, AIR and Cocoa support embedding browsers), you can use the client-side flow with one modification: a specific redirect_uri. Rather than requiring desktop apps to host a web server and populate the Site URL in the Developer App, we provide a specific URL you can use with desktop apps: https://www.facebook.com/connect/login_success.html.
我认为您关于嵌入网络浏览器的看法是正确的。
我建议您转向 Graph API 而不是 Rest,因为它正在弃用。
关于java - 使用 Java 的 Facebook OAuth 登录(仅限桌面),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10231613/