diff options
author | Pieter Ennes <pieter@authentiq.com> | 2017-02-21 21:34:07 +0000 |
---|---|---|
committer | Pieter Ennes <pieter@authentiq.com> | 2017-02-21 21:41:09 +0000 |
commit | 739c67342f71c94d10b0f2af869202a9391ae3f4 (patch) | |
tree | 2fb97c9040dedd86e17044dccfc4d81c1c3b79f3 | |
parent | d2c7be6c38c9cc2dd3f5ba0dffaf38be42fcb418 (diff) | |
download | oauthlib-739c67342f71c94d10b0f2af869202a9391ae3f4.tar.gz |
Redirect errors according to response_mode.
-rw-r--r-- | oauthlib/oauth2/rfc6749/errors.py | 4 | ||||
-rw-r--r-- | oauthlib/oauth2/rfc6749/grant_types/authorization_code.py | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/oauthlib/oauth2/rfc6749/errors.py b/oauthlib/oauth2/rfc6749/errors.py index 9f2ccef..9074b27 100644 --- a/oauthlib/oauth2/rfc6749/errors.py +++ b/oauthlib/oauth2/rfc6749/errors.py @@ -54,12 +54,14 @@ class OAuth2Error(Exception): self.client_id = request.client_id self.scopes = request.scopes self.response_type = request.response_type + self.response_mode = request.response_mode self.grant_type = request.grant_type if not state: self.state = request.state def in_uri(self, uri): - return add_params_to_uri(uri, self.twotuples) + return add_params_to_uri(uri, self.twotuples, + fragment=self.response_mode == "fragment") @property def twotuples(self): diff --git a/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py b/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py index 3d427ab..8a9d705 100644 --- a/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py +++ b/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py @@ -210,7 +210,10 @@ class AuthorizationCodeGrant(GrantTypeBase): except errors.OAuth2Error as e: log.debug('Client error during validation of %r. %r.', request, e) request.redirect_uri = request.redirect_uri or self.error_uri - return {'Location': common.add_params_to_uri(request.redirect_uri, e.twotuples)}, None, 302 + redirect_uri = common.add_params_to_uri( + request.redirect_uri, e.twotuples, + fragment=request.response_mode == "fragment") + return {'Location': redirect_uri}, None, 302 grant = self.create_authorization_code(request) for modifier in self._code_modifiers: |