Any good tutorials on using OAuth with Piston? [closed]
Asked Answered
J

2

23

I've looked at the relevant section of the Piston documentation, but it only seems to focus on how to turn it on, not what it would look like for clients or how to test it to verify it's working. The example only seems to use HTTP Basic and curl. Finally, Ned Batchelder's question makes it look like a tutorial is in order. Thanks.

Joselow answered 28/11, 2009 at 20:4 Comment(2)
I'll write one if I figure it out. Back to searching.Reft
I am also interested in this. I will return if I make any progress.Chiastic
P
15

I've just found one tutorial at http://blog.carduner.net/2010/01/26/django-piston-and-oauth/. Hope this would help someone.

Projectionist answered 27/3, 2010 at 13:28 Comment(2)
The timing on this answer couldn't have been any better. Thank you!Goraud
The tutorial only deals with how to set up Piston in your Django app. The question specifically asked how it would work for a client, and how to test it in a better way than curl (for example, in your Django unit tests). I'm looking for precisely that, and this answer doesn't cover it at all.Gwendolyn
E
1

I did benjamin dell; at what point are you? The endless loop? In that case; add this function to 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
    )

and set settings.OAUTH_CALLBACK_VIEW = "api.views.request_token_ready"

Eous answered 3/8, 2010 at 10:10 Comment(1)
this is used when the consumer doesn't provide a callback_url, correct?Brownie

© 2022 - 2024 — McMap. All rights reserved.