]> git.parisson.com Git - django-social-auth.git/commitdiff
fixed an exception when offline access flag is requested
authorLior Sion <liorsion@Lior-Sions-MacBook-Air.local>
Tue, 1 Feb 2011 12:29:28 +0000 (20:29 +0800)
committerMatías Aguirre <matiasaguirre@gmail.com>
Tue, 1 Feb 2011 13:45:05 +0000 (21:45 +0800)
social_auth/backends/facebook.py

index c73650efbc42f2ce8f37c2b1e00f46467b1e6c5a..4d19159f3b2073fb39eb10bcd4fa86fc5c70ebef 100644 (file)
@@ -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: