开发者

Facebook Authentication for Desktop (Console based) application

I am working on a python application which allows me to post updates/statuses to Facebook.

I am facing a basic problem with getting access tokens.

Since this application is working on the desktop, there is no question of using some web server.

I understand that I have to open a URL:

https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=https://www.facebook.com/connect/login_success.html

..and get the tokens out of the redirected URL.

But even this is out of option, since mine is a console based application. The closest I can get to using embedded browser is by using Python's mechanize module.

Is开发者_StackOverflow中文版 there any other option?


Maybe you can have some setup process where you obtain the tokens with offline access, that way the user will need to be presented with facebook login page only once, then you use this token later with the console app.

See offline_access on http://developers.facebook.com/docs/authentication/permissions/


Can you try using PhantomJS?

PhantomJS is a command-line tool that packs and embeds WebKit. Literally it acts like any other WebKit-based web browser, except that nothing gets displayed to the screen (thus, the term headless). In addition to that, PhantomJS can be controlled or scripted using its JavaScript API.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜