Skip to content

Commit

Permalink
Update version and error handler for authorization header
Browse files Browse the repository at this point in the history
Now returns an JSON format for decode when authorization header is not available
  • Loading branch information
dmtzs committed Feb 11, 2023
1 parent 0e773dd commit 9367f53
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = Flask-authgen-jwt
version = 4.0.0
version = 4.1.0
author = Diego Martinez
license = MIT
author_email = [email protected]
Expand Down
2 changes: 2 additions & 0 deletions src/flask_authgen_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ def __decode_jwt(self) -> Optional[dict]:
:return: the decoded token or None if an error occurred
"""
auth_header = request.headers.get("Authorization")
if auth_header is None:
self.gen_abort_error("Authorization header is missing", 400)
auth_header = auth_header.split(" ")
token = auth_header[1]
del auth_header
Expand Down

0 comments on commit 9367f53

Please sign in to comment.