From 7f62dc54882e8e9f6516590b4ab9be56d96bee6b Mon Sep 17 00:00:00 2001 From: Lior Sion Date: Tue, 1 Feb 2011 20:29:28 +0800 Subject: [PATCH] fixed an exception when offline access flag is requested --- social_auth/backends/facebook.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/social_auth/backends/facebook.py b/social_auth/backends/facebook.py index c73650e..4d19159 100644 --- a/social_auth/backends/facebook.py +++ b/social_auth/backends/facebook.py @@ -64,7 +64,9 @@ class FacebookAuth(BaseOAuth): error = self.data.get('error') or 'unknown error' raise ValueError('Authentication error: %s' % error) data['access_token'] = access_token - data['expires'] = response['expires'][0] + #expires will not be part of response if offline access premission was requested + if 'expires' in response: + data['expires'] = response['expires'][0] kwargs.update({'response': data, FacebookBackend.name: True}) return authenticate(*args, **kwargs) else: -- 2.39.5