dispatch/modules/integrations/integrations.py
def callback(cls, user, query):
        """Receive OAuth callback request from Facebook."""

        # Get settings for this integration
        settings = cls.get_settings(show_hidden=True)

        fb = Facebook()

        payload = {
            'client_id': settings['client_id'],
            'client_secret': settings['client_secret'],
            'code': query['code'],
            'redirect_uri': cls.REDIRECT_URI
        }

        try:

            # Authenticate with Facebook
            fb.get_access_token(payload)

            # Fetch pages belonging to authenticated user
            pages = fb.list_pages('me')

        except FacebookAPIError, e:
            raise IntegrationCallbackError(e.message)

        return {
            'pages': pages
        }
def callback(cls, user, query):
        """Receive OAuth callback request from Facebook."""

        # Get settings for this integration
        settings = cls.get_settings(show_hidden=True)

        fb = Facebook()

        payload = {
            'client_id': settings['client_id'],
            'client_secret': settings['client_secret'],
            'code': query['code'],
            'redirect_uri': cls.REDIRECT_URI
        }

        try:

            # Authenticate with Facebook
            fb.get_access_token(payload)

            # Fetch pages belonging to authenticated user
            pages = fb.list_pages('me')

        except FacebookAPIError, e:
            raise IntegrationCallbackError(e.message)

        return {
            'pages': pages
        }
Receive OAuth callback request from Facebook.