Skip to content

Commit f321e0e

Browse files
dawidwolski-identtdopry
authored andcommitted
check if token_value is None, then return
1 parent 07e0cdc commit f321e0e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

oauth2_provider/views/introspect.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class IntrospectTokenView(ClientProtectedScopedResourceView):
2626

2727
@staticmethod
2828
def get_token_response(token_value=None):
29+
if token_value is None:
30+
return JsonResponse(
31+
{"error": "invalid_request", "error_description": "Token parameter is missing."},
32+
status=400,
33+
)
2934
try:
3035
token_checksum = hashlib.sha256(token_value.encode("utf-8")).hexdigest()
3136
token = (
@@ -35,11 +40,6 @@ def get_token_response(token_value=None):
3540
)
3641
except ObjectDoesNotExist:
3742
return JsonResponse({"active": False}, status=200)
38-
except AttributeError:
39-
return JsonResponse(
40-
{"error": "invalid_request", "error_description": "Token parameter is missing."},
41-
status=400,
42-
)
4343
else:
4444
if token.is_valid():
4545
data = {

0 commit comments

Comments
 (0)