Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

protect against missing JSON data #109

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions flask_jwt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ def _default_request_handler():

def _default_auth_request_handler():
data = request.get_json()
if data is none:
raise JWTError('Bad Request', 'No JSON data received.')

username = data.get(current_app.config.get('JWT_AUTH_USERNAME_KEY'), None)
password = data.get(current_app.config.get('JWT_AUTH_PASSWORD_KEY'), None)
criterion = [username, password, len(data) == 2]
Expand Down