Skip to content

Commit 6416c38

Browse files
dawidwolski-identtdopry
authored andcommitted
check if token_value is None, then return
1 parent 02f34c1 commit 6416c38

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
defget_token_response(token_value=None):
29+
iftoken_valueisNone:
30+
returnJsonResponse(
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
exceptObjectDoesNotExist:
3742
returnJsonResponse({"active": False}, status=200)
38-
exceptAttributeError:
39-
returnJsonResponse(
40-
{"error": "invalid_request", "error_description": "Token parameter is missing."},
41-
status=400,
42-
)
4343
else:
4444
iftoken.is_valid():
4545
data={

0 commit comments

Comments
(0)