actually I'm going to do both :)

So first Client (consumer) needs to do this:
consumer = oauth.Consumer(key=CONSUMER_KEY, secret=CONSUMER_SECRET)
client = oauth.Client(consumer)
        
data['resp'], data['content'] = client.request(REQUEST_TOKEN_URL, 'GET')
-------------
And then Server needs to return token. The problem is that I can't find
how to do this in python-oauth2 way (not with Django).
Right now I have:
def request_token(request):
        data = {'token': 'token123'}
        return HttpResponse(simplejson.dumps(data), content_type =
'application/javascript; charset=utf8')

but this is for testing purpose only. I don't even know what token
should look like.

03.03.2011 19:56, Mick пишет:
> First are you trying to preform actions on the user's behalf on a thrid
> party site, or are you trying to authorize third parties to take an
> action on behalf of a user of your site?  (are you a Client or a Server
> in this case?)
> 
> 
> if you are a Client you need to request a request_token for the service
> you are authenticating with, redirect the user to an authorization url
> for them to login/authorize you, and then exchange the request token for
> an access_token.  That is what the python-auth2 django example code does.
> 
> If you are a Server  wanting to hand out keys to authenticate your
> service's users, there is a Server class in python-oauth2 that will be
> very helpful (especially in checking request signatures) But I dont know
> of any example django code (Someone else might).
> 
> 
> _Mick
> 
> On Thursday, March 3, 2011 at 2:51 AM, Олег Корсак wrote:
> 
>> Yes. But I'm stuck with first step... As I understood - first of all I
>> need to ask for request_token from my server. Done this. But what kind
>> of token and how server needs to return?
>> ----- Исходное сообщение -----
>>> In the README for python-oauth2
>>> (https://github.com/simplegeo/python-oauth2) there is a good example in
>>> the "Logging into Django w/ Twitter" section.
>>>
>>>
>>>
>>>
>>> _Mick
>>> On Wednesday, March 2, 2011 at 2:36 PM, Олег Корсак wrote:
>>>> hello. Is there any tutorial/example about oAuth 2.0 built into Django
>>>> and through python-oauth2-1.2.1 ? thanks
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group. To post to this group, send email to
>>> django-users@googlegroups.com <mailto:django-users@googlegroups.com>.
>>> To unsubscribe from this group, send
>>> email to django-users+unsubscr...@googlegroups.com
>>> <mailto:django-users+unsubscr...@googlegroups.com>. For more options,
>>> visit this group at http://groups.google.com/group/django-users?hl=en.
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com
>> <mailto:django-users@googlegroups.com>.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com
>> <mailto:django-users+unsubscr...@googlegroups.com>.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to