Issue #2 resolved

Urlparse and non-http scheme

Vladimir Mihailenco
created an issue

django-oauth relies on urlparse to add parameters to callback url. oauth_provider.models:116:

{{{ parts = urlparse.urlparse(self.callback) }}}

This works perfectly until non-http callback supplied. For example, Google Chrome OAuth generates following url, which can not be properly parsed with urlparse:

{{{

urlparse.urlparse('chrome-extension://fnaffgdfmcfbjiifjkhbfbnjljaabiaj.com/chrome_ex_oauth.html?q=1') ParseResult(scheme='chrome-extension', netloc='fnaffgdfmcfbjiifjkhbfbnjljaabiaj.com', path='/chrome_ex_oauth.html?q=1', params='', query='', fragment='') }}}

As you see query is empty here and urlunparse generates URL like this:

{{{ .../callback?foo=bar?oauth_verifier=foobar }}}

Possible fix could look like this:

{{{

!python

query = 'oauth_verifier=%s' % self.verifier if '?' in self.callback: query = '&' + query else: query = '?' + query return self.callback + query }}}

Comments (5)

  1. Log in to comment