2009-11-28 73 views
25

我已经看过relevant section of the Piston documentation,但它似乎只关注如何打开它,而不是它看起来像客户端或如何测试它来验证它的工作。 example似乎只使用HTTP Basic和curl。最后,Ned Batchelder's question使它看起来像一个教程是为了。谢谢。任何有关在活塞上使用OAuth的好教程?

+0

我会写一个,如果我弄明白。回到搜索。 – 2009-11-29 04:31:19

+0

我也对此感兴趣。如果我取得进展,我会回来。 – jathanism 2010-01-28 04:49:22

回答

15

我刚刚在http://blog.carduner.net/2010/01/26/django-piston-and-oauth/找到一个教程。希望这可以帮助某人。

+0

这个答案的时间可能不会更好。谢谢! – 2010-03-27 19:54:44

+0

本教程只涉及如何在您的Django应用程序中设置活塞。这个问题具体问到它如何为客户端工作,以及如何以比curl更好的方式对其进行测试(例如,在您的Django单元测试中)。我正在寻找这个,而这个答案根本不包括它。 – 2011-04-02 18:28:39

1

我做了本杰明戴尔;你在什么时候?无尽的循环?在这种情况下;这个功能添加到yourapp.api.views:

# Create your views here. 
from django.shortcuts import render_to_response 
from django.template import RequestContext 

def request_token_ready(request, token): 
    error = request.GET.get('error', '') 
    ctx = RequestContext(request, { 
     'error' : error, 
     'token' : token 
    }) 
    return render_to_response(
     'piston/request_token_ready.html', 
     context_instance = ctx 
    ) 

,并设置settings.OAUTH_CALLBACK_VIEW = “api.views.request_token_ready”

+0

这是在消费者没有提供callback_url时使用的,是否正确? – alexef 2012-02-11 14:32:32

相关问题