Note that there are some explanatory texts on larger screens.

plurals
  1. POTwitter auth fails on Twython 2.3.4 with Error: 401, Failed to validate oauth signature and token
    primarykey
    data
    text
    <p>I just updated to <a href="https://github.com/ryanmcgrath/twython" rel="nofollow">Twython</a> 2.3.4, but now my Twitter auth stops working. It fails on the ' auth_props = twitter.get_authentication_tokens()' line. Any idea what went wrong? Thanks in advance!</p> <p>The python code to do Twitter auth using Twython is below:</p> <pre><code>def begin_auth(request): twitter = Twython( twitter_token = TWITTER_KEY, twitter_secret = TWITTER_SECRET, callback_url = request.build_absolute_uri(reverse('portnoy.views.thanks')) ) # Request an authorization url to send the user to... auth_props = twitter.get_authentication_tokens() </code></pre> <p><strong>I have the following error on the line above: TwythonAuthError: "Seems something couldn't be verified with your OAuth junk. Error: 401, Message: Failed to validate oauth signature and token"</strong></p> <pre><code> # Then send them over there, durh. request.session['request_token'] = auth_props return HttpResponseRedirect(auth_props['auth_url']) def thanks(request, redirect_url='/'): c = RequestContext(request) # for permanent ones and store them... twitter = Twython( twitter_token = TWITTER_KEY, twitter_secret = TWITTER_SECRET, oauth_token = request.session['request_token']['oauth_token'], oauth_token_secret = request.session['request_token']['oauth_token_secret'] ) # Retrieve the tokens we want... authorized_tokens = twitter.get_authorized_tokens() request.session['request_tokens'] = authorized_tokens debug('thanks', request.session['request_tokens']) user = User.objects.filter(username=authorized_tokens['screen_name']) if user.exists(): user = user[0] user.backend='django.contrib.auth.backends.ModelBackend' auth.login(request,user) else: return render_to_response('twitter_register.html', c) return HttpResponseRedirect(redirect_url) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload