cd34/apex

Valruse vs Apex callbacks

mpekalski opened this issue · 1 comments

I cannot get Varluse to work with Apex. At the moment I try to make it work with Facebook, with the form callback set to apex_callback. But I think I found where the problem is, it is apex_callback and what verluse asks for in a form.

The problem I think is in those files
https://github.com/bbangert/velruse/blob/master/velruse/providers/facebook.py
https://github.com/cd34/apex/blob/master/apex/views.py

The apex_callback assumes the token is already in the reply from facebook, whereas Velruse in its callback makes a request to FB for the token.

apex_callbackwill not do anything if token is not in request.POST, which by default is not

def apex_callback(request):
    """ apex_callback(request):
    no return value, called with route_url('apex_callback', request)
    This is the URL that Velruse returns an OpenID request to
    """
    redir = request.GET.get('came_from', \
                route_url(apex_settings('came_from_route'), request))
    headers = []
    if 'token' in request.POST:
        auth = None

Velruse callback after checkinf csfr and code got from the initial request will ask for token, which apex_callback does not do.

 # Now retrieve the access token with the code
        access_url = flat_url(
            'https://graph.facebook.com/oauth/access_token',
            client_id=self.consumer_key,
            client_secret=self.consumer_secret,
            redirect_uri=request.route_url(self.callback_route),
            code=code)
        r = requests.get(access_url)

Am I right or am I missing something?

Just a note, I am trying to integrate Velruse and Apex with my app not to run Velruse as a service.

I think the problem is that Apex assumes it works with Velruse as a service, not a plugin.