diff --git a/oauth2_provider/views/mixins.py b/oauth2_provider/views/mixins.py index 168d5f42d..919878a9f 100644 --- a/oauth2_provider/views/mixins.py +++ b/oauth2_provider/views/mixins.py @@ -155,9 +155,17 @@ def error_response(self, error, **kwargs): :param error: :attr:`OAuthToolkitError` """ oauthlib_error = error.oauthlib_error + + separator = '?' + try: + if '?' in oauthlib_error.redirect_uri: + separator = '&' + except: + pass + error_response = { 'error': oauthlib_error, - 'url': "{0}?{1}".format(oauthlib_error.redirect_uri, oauthlib_error.urlencoded) + 'url': "{0}{1}{2}".format(oauthlib_error.redirect_uri, separator, oauthlib_error.urlencoded) } error_response.update(kwargs)