From 80b99c896080ed6fd82f61ddc0e1cc3f08a81094 Mon Sep 17 00:00:00 2001 From: Marcelo Jorge Vieira Date: Mon, 7 Dec 2015 11:25:31 -0200 Subject: [PATCH 1/2] Remove unused import --- tastypie_oauth/authentication.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tastypie_oauth/authentication.py b/tastypie_oauth/authentication.py index e30dfb4..9110c66 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 From 20c4f4ad91b8829cc853e4a37aaf3a52ac78f9ce Mon Sep 17 00:00:00 2001 From: Marcelo Jorge Vieira Date: Mon, 7 Dec 2015 11:25:40 -0200 Subject: [PATCH 2/2] Fixed is_authenticated() Error: 'NoneType' object has no attribute 'has_perm'. It happens when a 'client_credentials' is used to POST a resource URL. --- tastypie_oauth/authentication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tastypie_oauth/authentication.py b/tastypie_oauth/authentication.py index 9110c66..5ef2aae 100644 --- a/tastypie_oauth/authentication.py +++ b/tastypie_oauth/authentication.py @@ -63,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