Open qria opened 3 years ago
As a workaround I am doing this for now:
import urllib.parse
# oauth_session.parse_authorization_response(request.url) # this is bugged
qs_dict = urllib.parse.parse_qs(urllib.parse.urlparse(request.url).query)
token = {
'oauth_token': qs_dict['oauth_token'][0],
'oauth_verifier': qs_dict['oauth_verifier'][0],
}
oauth_session.token = token
With callback url there can be additional parameters such as
next
as well as theoauth_token
andoauth_verificer
, and there can be unquoted strings in it.For example, my callback url was:
"/login/twitter-callback?next=ㅋㅋ&oauth_token=<redacted>&oauth_verifier=<redacted>"
Calling
OAuth1Session.parse_authorization_response
on above url yields an error:But this is not the culprit because of how
urldecode
is coded to ignore failed urldecode attempts:The real error is:
You can reproduce this error with this code: