开发者

Is it possible to build a desktop based application using Twython without using Django? Oauth2 causing problem

开发者 https://www.devze.com 2023-04-05 14:25 出处:网络
I downloaded the Twython source code and compiled it on my system. I am developing a desktop app, rather than a web-app. Thus, I don\'t see the use of Django-Oauth2 implementation in my little project

I downloaded the Twython source code and compiled it on my system. I am developing a desktop app, rather than a web-app. Thus, I don't see the use of Django-Oauth2 implementation in my little project.

This is being asked in twython.py

self.request_token_url = 'http://twitter.com/oauth/request_token'
        self.access_token_url = 'http://twitter.com/oauth/access_token'
        self.authorize_url = 'http://twitter.com/oauth/authorize'
        self.authenticate_url = 'http://twitter.com/oauth/authenticate'
        self.twitter_token = twitter_token
        self.twitter_secret = twitter_secret
        self.oauth_token = oauth_token
        self.oauth_secret = oauth_token_se开发者_StackOverflow中文版cret
        self.callback_url = callback_url

The problem here is that,

I don't know what is a "twitter_secret" or a "twitter_token". In the twitter dev, after registering my app, I got my customer key and secret. Also, got twitter key and secret. My callback_url is None. And, as twitter forced me to mention a website, I gave my localhost address and it got accepted. Now, I don't know how to move forward with the Oauth2 authentication.

What should I do next?


I'm the author of Twython.

Sadly, OAuth is a less than ideal method for authenticating in... well, anything outside of a web browser. While it's possible you could figure out some hacky method to make this work, if you're concerned about the user experience you may just want to request xAuth permission from Twitter:

https://dev.twitter.com/docs/auth

It's still OAuth, so most of the internal Twython pieces should be fine. While Twython doesn't outright support xAuth (due to Twitter's stance on advocating not using it...), I'm definitely open to taking a patch or two if enough people need it. ;)

Another option would be OOB authentication (which requires your users getting and entering a PIN, not generally great UX).

0

精彩评论

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

关注公众号