Skip to content

Commit ea51411

Browse files
authored
Update middleware.py (#1380)
* Update middleware.py Use `get_access_token_model` instead of `AccessToken` * Update CHANGELOG.md * Update AUTHORS
1 parent 2b56a48 commit ea51411

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Julien Palard
7575
Jun Zhou
7676
Kaleb Porter
7777
Kristian Rune Larsen
78+
Lazaros Toumanidis
7879
Ludwig Hähne
7980
Łukasz Skarżyński
8081
Marcus Sonestedt

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3636
* #1336 Fix encapsulation for Redirect URI scheme validation
3737
* #1357 Move import of setting_changed signal from test to django core modules
3838
* #1268 fix prompt=none redirects to login screen
39+
* #1381 fix AttributeError in OAuth2ExtraTokenMiddleware when a custom AccessToken model is used
3940

4041
### Removed
4142
* #1350 Remove support for Python 3.7 and Django 2.2

oauth2_provider/middleware.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from django.contrib.auth import authenticate
44
from django.utils.cache import patch_vary_headers
55

6-
from oauth2_provider.models import AccessToken
6+
from oauth2_provider.models import get_access_token_model
77

88

99
log = logging.getLogger(__name__)
@@ -53,6 +53,7 @@ def __call__(self, request):
5353
authheader = request.META.get("HTTP_AUTHORIZATION", "")
5454
if authheader.startswith("Bearer"):
5555
tokenstring = authheader.split()[1]
56+
AccessToken = get_access_token_model()
5657
try:
5758
token = AccessToken.objects.get(token=tokenstring)
5859
request.access_token = token

0 commit comments

Comments
 (0)