Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tastypie_oauth/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def is_authenticated(self, request, **kwargs):
if not key and request.method == 'POST':
if request.META.get('CONTENT_TYPE') == 'application/json':
decoded_body = request.body.decode('utf8')
key = json.loads(decoded_body)['oauth_consumer_key']
try:
key = json.loads(decoded_body)['oauth_consumer_key']
except (ValueError, KeyError):
pass
if not key:
log.info('OAuth20Authentication. No consumer_key found.')
return None
Expand All @@ -75,6 +78,8 @@ def is_authenticated(self, request, **kwargs):
log.exception("Error in OAuth20Authentication.")
request.user = AnonymousUser()
return False
except OAuthError:
return False
except Exception:
log.exception("Error in OAuth20Authentication.")
return False
Expand Down