aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rest_framework/authentication.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/rest_framework/authentication.py b/rest_framework/authentication.py
index c74078fc..d4ba7967 100644
--- a/rest_framework/authentication.py
+++ b/rest_framework/authentication.py
@@ -176,7 +176,7 @@ class OAuth2Authentication(BaseAuthentication):
"""
auth = request.META.get('HTTP_AUTHORIZATION', '').split()
if not auth or auth[0].lower() != "bearer":
- return None
+ raise exceptions.AuthenticationFailed('Invalid Authorization token type')
if len(auth) != 2:
raise exceptions.AuthenticationFailed('Invalid token header')
@@ -212,8 +212,6 @@ class OAuth2Authentication(BaseAuthentication):
raise exceptions.AuthenticationFailed(
'You are not allowed to access this resource.')
- return None
-
def authenticate_header(self, request):
"""
Bearer is the only finalized type currently