def get_handler(self): from linked_accounts.handlers import AuthHandler return AuthHandler.get_handler(self.service)
def authenticate(self, service=None, token=None, expires=None): if isinstance(token, basestring) and service in ['facebook', 'google']: token = OAuth20Token(token, expires) handler = AuthHandler.get_handler(service) return handler.get_profile(token)
def link_profile_to_user(self): profile = AuthHandler.get_handler(self.access.SERVICE).get_profile(self.token) if not profile.user: profile.user = self.request.user profile.save() return profile