diff --git a/tastypie_oauth/authentication.py b/tastypie_oauth/authentication.py index e30dfb4..5ef2aae 100644 --- a/tastypie_oauth/authentication.py +++ b/tastypie_oauth/authentication.py @@ -6,7 +6,6 @@ from django.contrib.auth.models import AnonymousUser from django.utils import timezone from tastypie.authentication import Authentication -from tastypie.http import HttpUnauthorized """ This is a simple OAuth 2.0 authentication model for tastypie @@ -64,7 +63,7 @@ def is_authenticated(self, request, **kwargs): # If OAuth authentication is successful, set the request user to # the token user for authorization - request.user = token.user + request.user = token.user or AnonymousUser() # If OAuth authentication is successful, set oauth_consumer_key on # request in case we need it later