Esempio n. 1
0
def auth(request):
    """Setup oauth details for the return call from foursquare"""
    request.session['causal_foursquare_oauth_return_url'] = \
           request.GET.get('HTTP_REFERER', None)
    service = get_model_instance(request.user, MODULE_NAME)
    if not service:
        app = ServiceApp.objects.get(module_name=MODULE_NAME)
        service = UserService(user=request.user, app=app)
        service.save()
    return user_login(service)
Esempio n. 2
0
def auth(request):
    """Prepare a oauth request by saving a record locally ready for the
    redirect from twitter."""
    request.session['causal_twitter_oauth_return_url'] = \
           request.GET.get('HTTP_REFERER', None)
    service = get_model_instance(request.user, MODULE_NAME)
    if not service:
        app = ServiceApp.objects.get(module_name=MODULE_NAME)
        service = UserService(user=request.user, app=app)
        service.save()
    else:
        logging.error('Service not found')
    return user_login(service)
Esempio n. 3
0
def auth(request):
    """First leg of the two stage auth process. We setup and take note"""

    request.session['causal_facebook_oauth_return_url'] = \
        request.GET.get('HTTP_REFERER', None)
    service = get_model_instance(request.user, MODULE_NAME)

    if not service:
        app = ServiceApp.objects.get(module_name=MODULE_NAME)
        service = UserService(user=request.user, app=app)
        service.save()
    callback = "%s%s" % (service.app.oauth.callback_url_base,
                         reverse('causal-facebook-callback'),)
    return redirect("%s&redirect_uri=%s&scope=%s&client_id=%s" % (
            service.app.oauth.request_token_url,
            callback,
            'read_stream,offline_access,user_photos,user_photo_video_tags,user_checkins',
            service.app.oauth.consumer_key
        )
    )