diff --git a/oauth2_provider/oauth2_backends.py b/oauth2_provider/oauth2_backends.py index f04463d2..accd9d3f 100644 --- a/oauth2_provider/oauth2_backends.py +++ b/oauth2_provider/oauth2_backends.py @@ -1,11 +1,11 @@ import json from urllib.parse import urlparse, urlunparse +from django.http import HttpRequest from oauthlib import oauth2 from oauthlib.common import Request as OauthlibRequest from oauthlib.common import quote, urlencode, urlencoded from oauthlib.oauth2 import OAuth2Error -from django.http import HttpRequest from .exceptions import FatalClientError, OAuthToolkitError from .settings import oauth2_settings diff --git a/oauth2_provider/oauth2_validators.py b/oauth2_provider/oauth2_validators.py index 7e7c36e9..9bb94c0a 100644 --- a/oauth2_provider/oauth2_validators.py +++ b/oauth2_provider/oauth2_validators.py @@ -56,7 +56,7 @@ AbstractApplication.GRANT_CLIENT_CREDENTIALS, AbstractApplication.GRANT_OPENID_HYBRID, ), - "urn:ietf:params:oauth:grant-type:device_code": (AbstractApplication.GRANT_DEVICE_CODE,) + "urn:ietf:params:oauth:grant-type:device_code": (AbstractApplication.GRANT_DEVICE_CODE,), } Application = get_application_model() @@ -167,8 +167,9 @@ def _authenticate_basic_auth(self, request): elif request.client.client_id != client_id: log.debug("Failed basic auth: wrong client id %s" % client_id) return False - elif (request.client.client_type == "public" - and request.grant_type == "urn:ietf:params:oauth:grant-type:device_code" + elif ( + request.client.client_type == "public" + and request.grant_type == "urn:ietf:params:oauth:grant-type:device_code" ): return True elif not self._check_secret(client_secret, request.client.client_secret): diff --git a/oauth2_provider/urls.py b/oauth2_provider/urls.py index 5bc9586b..e7dfe848 100644 --- a/oauth2_provider/urls.py +++ b/oauth2_provider/urls.py @@ -11,7 +11,7 @@ path("token/", views.TokenView.as_view(), name="token"), path("revoke_token/", views.RevokeTokenView.as_view(), name="revoke-token"), path("introspect/", views.IntrospectTokenView.as_view(), name="introspect"), - path("device_authorization/", views.DeviceAuthorizationView.as_view(), name="device-authorization") + path("device_authorization/", views.DeviceAuthorizationView.as_view(), name="device-authorization"), ]