[Django]-How to pass oauth_callback value to oauth/request_token with Twython

3๐Ÿ‘

โœ…

I solved my own answer. Here is the solution if it can help anyone else:

In the file Twython.py, I added a new parameter oauth_verifier to the Twython class constructor . I get the oauth_verifier value from the callback_url in my twitter_thanks view.

In get_authorized_tokens I removed this line of code:

response = self.client.get(self.access_token_url)

and added the following code:

callback_url = self.callback_url or 'oob'
request_args = urllib.urlencode({'oauth_callback': callback_url, 'oauth_verifier':self.oauth_verifier })
response = self.client.post(self.access_token_url, params=request_args)

It now works like a charm and is OAuth 1.0A compliant.

๐Ÿ‘คBuddyTeal

Leave a comment