Skip to content

Commit 5d3184f

Browse files
authored
Merge pull request #22 from auth0-samples/update-python-api
Update python api
2 parents 2483772 + 7454fdb commit 5d3184f

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

00-Starter-Seed/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
flask
22
python-dotenv
3-
python-jose
3+
python-jose-cryptodome
44
flask-cors
55
six

00-Starter-Seed/server.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ def requires_scope(required_scope):
7070
"""
7171
token = get_token_auth_header()
7272
unverified_claims = jwt.get_unverified_claims(token)
73-
token_scopes = unverified_claims["scope"].split()
74-
for token_scope in token_scopes:
75-
if token_scope == required_scope:
76-
return True
73+
if unverified_claims.get("scope"):
74+
token_scopes = unverified_claims["scope"].split()
75+
for token_scope in token_scopes:
76+
if token_scope == required_scope:
77+
return True
7778
return False
7879

7980

0 commit comments

Comments
 (0)