Skip to content

Conversation

@glaucojunior22
Copy link
Contributor

Fixes #1276

Even after the PR #1276 if the request don't have the client_secret field the response will be:
status_code: 401
{"error": "invalid_client"}
Demo image

The only way to retrieve the token is sending the client_secret field as an empty string:
Demo image

This PR is to allow the first case (request without a client_secret field) to work accordingly to the RFC specification

Reason

The Oauthlib Request object always have the client_secret param initialized as None, so getattr(request, "client_secret", "") will return None intead of the empty string even if the original request doesn't send the parameter, this is why I added the or "" at the end of this line.

Checklist

  • [x ] PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated
  • CHANGELOG.md updated (only for user relevant changes)
  • [x ] author name in AUTHORS

Copy link
Contributor

@n2ygk n2ygk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Sorry for the delay in reviewing this.

@codecov
Copy link

codecov bot commented May 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.56%. Comparing base (560f84d) to head (5101903).
Report is 3 commits behind head on master.

❗ Current head 5101903 differs from pull request most recent head 14b3365. Consider uploading reports for the commit 14b3365 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1288   +/-   ##
=======================================
  Coverage   97.56%   97.56%           
=======================================
  Files          32       32           
  Lines        2132     2133    +1     
=======================================
+ Hits         2080     2081    +1     
  Misses         52       52           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@n2ygk n2ygk merged commit 6ae8197 into django-oauth:master May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants