How to login / authenticate facebook without browser for desktop application in C#

社会主义新天地 提交于 2019-12-04 05:54:13

It is not possible. See this link: https://developers.facebook.com/docs/authentication/

To quote from that link:

Desktop Apps

Our OAuth 2.0 implementation does not include explicit desktop app support. However, if your desktop 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.

The reason that this is not possible is that facebook uses the OAuth protocol. More details on the OAuth protocol can be found at: http://tools.ietf.org/html/rfc5849

The fundamental motivation behind OAuth is so that the resource that needs authorization does not need to know the credentials/identity of users.

What you are proposing (taking in the clients username/password) goes against the fundamental tenets of the OAuth protocol and you cannot (at least legally) achieve this with facebook.

benthehutt

Both of your examples actually do use browsers. Tweetdeck is AIR, and Nimbuzz is .NET, both of which have browsers built-in that are behind the scenes. There is one way to authenticate without a browser, but it's nasty.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!