Skip to content

Commit

Permalink
Rename parameters of InsufficientScopeError
Browse files Browse the repository at this point in the history
ref: #333
  • Loading branch information
lepture committed Oct 18, 2021
1 parent afaeaf9 commit e880f16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions authlib/oauth2/rfc6750/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ class InsufficientScopeError(OAuth2Error):
error = 'insufficient_scope'
status_code = 403

def __init__(self, token_scope, resource_scope):
def __init__(self, token_scope, required_scope):
super(InsufficientScopeError, self).__init__()
self.token_scope = token_scope
self.resource_scope = resource_scope
self.required_scope = required_scope

def get_error_description(self):
return self.gettext(
'The request requires higher privileges than '
'provided by the access token. '
'Required: "%(required)s", Provided:"%(provided)s"'
) % dict(required=self.resource_scope, provided=self.token_scope)
) % dict(required=self.required_scope, provided=self.token_scope)
2 changes: 1 addition & 1 deletion authlib/oauth2/rfc6750/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,5 @@ def __call__(self, token_string, scope, request, scope_operator='AND'):
if self.token_revoked(token):
raise InvalidTokenError(realm=self.realm)
if self.scope_insufficient(token, scope, scope_operator):
raise InsufficientScopeError(token_scope=token.get_scope(), resource_scope=scope)
raise InsufficientScopeError(token.get_scope(), scope)
return token

0 comments on commit e880f16

Please sign in to comment.