From 2a467761fd6bd75bd048ce1ed5e7a75a97d95922 Mon Sep 17 00:00:00 2001 From: Michael Armida Date: Mon, 5 Mar 2012 22:35:45 -0800 Subject: [PATCH] make BaseOAuth2 behave like ConsumerBasedOAuth when requesting an access token leads to a HTTP 400; previously it lead to an unhandled exception, although I don't know that "Authentication process canceled" is much better --- social_auth/backends/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/social_auth/backends/__init__.py b/social_auth/backends/__init__.py index ceaffcf..766bb6f 100644 --- a/social_auth/backends/__init__.py +++ b/social_auth/backends/__init__.py @@ -658,6 +658,11 @@ class BaseOAuth2(BaseOAuth): try: response = simplejson.loads(urlopen(request).read()) + except HTTPError, e: + if e.code == 400: + raise AuthCanceled(self) + else: + raise except (ValueError, KeyError): raise AuthUnknownError(self) -- 2.39.5