Skip to content

Commit f450855

Browse files
committed
fix: token throws an error when client is provided as a string
instead of the client_id
1 parent 71d2605 commit f450855

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

oauth2_provider/oauth2_validators.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ def _load_application(self, client_id, request):
208208

209209
try:
210210
if not isinstance(request.client, Application):
211+
log.debug("invalid client type, Loading application for client_id %r", client_id)
211212
request.client = Application.objects.get(client_id=client_id)
212213
# Check that the application can be used (defaults to always True)
213214
if not request.client.is_usable(request):
@@ -216,6 +217,7 @@ def _load_application(self, client_id, request):
216217
return request.client
217218
except Application.DoesNotExist:
218219
log.debug("Failed body authentication: Application %r does not exist" % (client_id))
220+
request.client = None
219221
return None
220222

221223
def _set_oauth2_error_on_request(self, request, access_token, scopes):
@@ -278,6 +280,7 @@ def client_authentication_required(self, request, *args, **kwargs):
278280
pass
279281

280282
self._load_application(request.client_id, request)
283+
log.debug("Determining if client authentication is required for client %r", request.client)
281284
if request.client:
282285
return request.client.client_type == AbstractApplication.CLIENT_CONFIDENTIAL
283286

0 commit comments

Comments
 (0)