@@ -624,27 +624,11 @@ def handle_oauth1_response(self):
624624
625625 def handle_oauth2_response (self ):
626626 """Handles an oauth2 authorization response."""
627-
628- # Remove the 'code' argument from current URL
629- oauth_redir_tuple = urlparse (request .url )
630- query_args = [
631- arg_pair for arg_pair in parse_qsl (oauth_redir_tuple .query )
632- if arg_pair [0 ] != 'code'
633- ]
634- oauth_redir = urlunparse (
635- oauth_redir_tuple [0 :4 ] +
636- (urlencode (query_args , doseq = True ),) +
637- oauth_redir_tuple [5 :]
638- )
639-
640- # TODO: Just fetch from current_app.config?
641- log .debug ('redirect_uri: {}' .format (oauth_redir ))
642-
643627 client = self .make_client ()
644628 remote_args = {
645629 'code' : request .args .get ('code' ),
646630 'client_secret' : self .consumer_secret ,
647- 'redirect_uri' : oauth_redir
631+ 'redirect_uri' : current_app . config [ 'OAUTH_CALLBACK_URL' ]
648632 }
649633 log .debug ('Prepare oauth2 remote args %r' , remote_args )
650634 remote_args .update (self .access_token_params )
@@ -672,9 +656,6 @@ def handle_oauth2_response(self):
672656 'Unsupported access_token_method: %s' %
673657 self .access_token_method
674658 )
675-
676- log .debug ('Resp: {}' .format (resp ))
677-
678659 data = parse_response (resp , content , content_type = self .content_type )
679660 if resp .code not in (200 , 201 ):
680661 raise OAuthException (
0 commit comments