if token.key != request.GET.get('oauth_token', 'no-token'):
raise InvalidAuthentication(_("Something went wrong! Auth tokens do not match"))
- access_token = self.fetch_access_token(token)
+ access_token = self.fetch_access_token(token, request.GET.get('oauth_verifier', ''))
return access_token.to_string()
parameters = {}
# If the installation is configured to automatically redirect to the Twitter provider done page -- do it.
if bool(TWITTER_AUTO_CALLBACK_REDIRECT):
- callback_url = '%s%s' % (APP_URL, reverse('auth_provider_done', kwargs={ 'provider' : 'twitter', }))
+ callback_url = '%s%s' % (APP_URL, reverse('auth_provider_done', prefix='/', kwargs={'provider' : 'twitter'}))
# Pass
parameters.update({
'oauth_callback' : callback_url,
full_url='%s?%s'%(self.authorization_url, data)
return full_url
- def fetch_access_token(self, token):
+ def fetch_access_token(self, token, oauth_verifier):
oauth_request = oauth2.Request.from_consumer_and_token(self.consumer, token=token, http_url=self.access_token_url)
+ oauth_request['oauth_verifier'] = oauth_verifier
oauth_request.sign_request(self.signature_method, self.consumer, token)
params = oauth_request
data = urllib.urlencode(params)