Skip to content

Commit 48a079f

Browse files
committed
Don't return 401 since it's an error code.
1 parent c14a2ef commit 48a079f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

section11/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
jwt = JWTManager(app)
2525

2626
"""
27-
`claims` are data we choose to attached to each jwt payload
27+
`claims` are data we choose to attach to each jwt payload
2828
and for each jwt protected endpoint, we can retrieve these claims via `get_jwt_claims()`
2929
one possible use case for claims are access level control, which is shown below
3030
"""
3131
@jwt.user_claims_loader
3232
def add_claims_to_jwt(identity):
33-
if identity == 1: # instead of hard-coding, we can read from a config file to get a list of admins instead
33+
if identity == 1: # instead of hard-coding, we should read from a config file to get a list of admins instead
3434
return {'is_admin': True}
3535
return {'is_admin': False}
3636

section11/resources/item.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,4 @@ def get(self):
8080
items = [item.json() for item in ItemModel.find_all()]
8181
if user_id:
8282
return {'items': items}, 200
83-
return {'items': [item['name'] for item in items]}, 401
83+
return {'items': [item['name'] for item in items]}, 200

0 commit comments

Comments
 (0)