Skip to content

Commit 52b2f96

Browse files
committed
Added 404 condition for token not found
1 parent c9a5c1d commit 52b2f96

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

apps/dot_ext/views/authorization.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
)
2222
from oauth2_provider.models import get_application_model
2323
from oauthlib.oauth2.rfc6749.errors import InvalidClientError, InvalidGrantError
24+
from rest_framework import status
2425
from urllib.parse import urlparse, parse_qs
2526

2627
from apps.dot_ext.scopes import CapabilitiesScopes
@@ -371,6 +372,10 @@ def post(self, request, *args, **kwargs):
371372
except Exception:
372373
token = at_model.objects.get(
373374
token=request.POST.get("token"))
375+
376+
if token is None:
377+
return HttpResponse("Token was Not Found. Please check the value and try again.",
378+
status=status.HTTP_404_NOT_FOUND)
374379
try:
375380
dag = DataAccessGrant.objects.get(
376381
beneficiary=token.user,

0 commit comments

Comments
 (0)