【问题标题】:Any good tutorials on using OAuth with Piston? [closed]任何关于使用 OAuth 和 Piston 的好教程? [关闭]
【发布时间】:2010-12-21 06:45:21
【问题描述】:

我查看了relevant section of the Piston documentation,但它似乎只关注如何打开它,而不是它对客户的外观或如何测试它以验证它是否正常工作。 example 似乎只使用 HTTP Basic 和 curl。最后,Ned Batchelder's question 使它看起来像教程一样。谢谢。

【问题讨论】:

  • 如果我弄明白了我会写一个。返回搜索。
  • 我也对这个感兴趣。如果我有任何进展,我会回来。

标签: django oauth django-piston


【解决方案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"

【讨论】:

  • 这是在消费者不提供 callback_url 时使用的,对吗?
【解决方案2】:

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

【讨论】:

  • 这个答案的时机再好不过了。谢谢!
  • 本教程仅涉及如何在您的 Django 应用程序中设置 Piston。该问题专门询问了它如何为客户端工作,以及如何以比 curl 更好的方式对其进行测试(例如,在您的 Django 单元测试中)。我正在寻找的正是那个,而这个答案根本没有涵盖它。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-03-06
  • 2013-01-08
  • 2012-01-14
  • 1970-01-01
  • 2010-12-10
  • 2011-03-29
  • 1970-01-01
相关资源
最近更新 更多