Skip to content

Conversation

@Tuhin-thinks
Copy link
Contributor

@Tuhin-thinksTuhin-thinks commented Sep 21, 2024

Fixed the crash in application while using OAuth2ExtraTokenMiddleware. When Bearer token passed is empty.
Authorization: Bearer would result in this crash.

Fixes#1496

Description of the Change

Checklist

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

@n2ygkn2ygk added this to the Release 3.1.0 milestone Sep 22, 2024
@n2ygkn2ygkforce-pushed the bug/1496/unhandled-empty-bearer-token-exception branch from 3efa9a5 to f87c5f4CompareSeptember 22, 2024 17:56
n2ygk
n2ygk previously requested changes Sep 22, 2024
Copy link
Contributor

@n2ygkn2ygk left a comment

Choose a reason for hiding this comment

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

Thanks for this fix. Please also add a test case in tests/test_auth_backends.py to assure full code coverage.

@dopry
Copy link
Member

dopry commented Oct 4, 2024

@Tuhin-thinks this looks good. I think the last task to get this merge ready is the test.

@Tuhin-thinks
Copy link
ContributorAuthor

@dopry Thanks, I am getting them ready.

@dopry
Copy link
Member

dopry commented Nov 3, 2025

@Tuhin-thinks any updates on the tests?

@Tuhin-thinks
Copy link
ContributorAuthor

@Tuhin-thinks any updates on the tests?

Hi, @dopry really sorry about the long wait.
Added test cases now, for middleware.py file's validation.

Please let me know once you find time to review this.

@dopry
Copy link
Member

Hi, @dopry really sorry about the long wait. Added test cases now, for middleware.py file's validation.

Please let me know once you find time to review this.

Say nothing of it. It's open source and we're all volunteers. There isn't a schedule to keep here. :)

@codecov
Copy link

codecovbot commented Nov 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@doprydopryforce-pushed the bug/1496/unhandled-empty-bearer-token-exception branch from cd6eac8 to 10a210aCompareNovember 14, 2025 01:56
@doprydopry dismissed n2ygk’s stale reviewNovember 14, 2025 02:05

His comments have been addressed. Tests are added and the split issue is resolved.

@doprydopry merged commit bade920 into django-oauth:masterNov 14, 2025
26 checks passed
Sign up for freeto 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.

Empty Bearer token results in unhandled exception

3 participants

@Tuhin-thinks@dopry@n2ygk