Skip to content

Commit 484b44d

Browse files
committed
fix: token throws an error when client is provided as a string
instead of the client_id
1 parent 12a2dae commit 484b44d

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
@@ -220,6 +220,7 @@ def _load_application(self, client_id, request):
220220

221221
try:
222222
if not isinstance(request.client, Application):
223+
log.debug("invalid client type, Loading application for client_id %r", client_id)
223224
request.client = Application.objects.get(client_id=client_id)
224225
# Check that the application can be used (defaults to always True)
225226
if not request.client.is_usable(request):
@@ -228,6 +229,7 @@ def _load_application(self, client_id, request):
228229
return request.client
229230
except Application.DoesNotExist:
230231
log.debug("Failed body authentication: Application %r does not exist" % (client_id))
232+
request.client = None
231233
return None
232234

233235
def _set_oauth2_error_on_request(self, request, access_token, scopes):
@@ -290,6 +292,7 @@ def client_authentication_required(self, request, *args, **kwargs):
290292
pass
291293

292294
self._load_application(request.client_id, request)
295+
log.debug("Determining if client authentication is required for client %r", request.client)
293296
if request.client:
294297
return request.client.client_type == AbstractApplication.CLIENT_CONFIDENTIAL
295298

0 commit comments

Comments
 (0)