diff options
-rw-r--r-- | api.py | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -31,12 +31,13 @@ class AccessChecker: logging.error('No valid access token') return False - scopes = token.get('scope', '').split() - missing = set(required_scopes).difference(scopes) - if missing: - logging.error( - 'Required scopes that are missing from token: %r', missing) - return False + if token: + scopes = token.get('scope', '').split() + missing = set(required_scopes).difference(scopes) + if missing: + logging.error( + 'Required scopes that are missing from token: %r', missing) + return False return True @@ -101,7 +102,7 @@ class Controller(API): 'method': 'GET', 'path': '/hello/<name>', 'func': self._hello, - 'scopes': [], + 'scopes': ['hello'], }, ] |