Hi Giuseppe,

I do not know that library, but seems to me you can use oauth2 auth from
web2py and then use the auth token to work with rauth.

The following is what I would try (untested) by having read
https://rauth.readthedocs.org/en/latest/api/#oauth-2-0-sessions.  If it
goes to no good, you can make always make your own  login method by copying
modifying the source or by simply subclassing OAuthAccount class.

----------------------

in a model put
from gluon.contrib.login_methods.oauth20_account import OAuthAccount

class TwitterAuth(OAuthAccount):
     def __init__(self):
               OAuthAccount.__init__(self,
                                     client_id=TWITTER_APP_ID,
                                     client_secret=TWITTER_APP_SECRET,
                                     auth_url=self.AUTH_URL,
                                     token_url=self.TOKEN_URL,)
                self.rauth = None


""" override get_user(self)
"""
def get_user(self):
   self.rauth_session = rauth.OAuth2Session(TWITTER_APP_ID,
TWITTER_APP_SECRET, access_token=self.accessToken())

   if  self.rauth_session:
        return self.rauth_session.get(<an object to uniquely identify user>)

auth.setting.login_form=TwitterAuth()
# make a reference rauth session to make it easy usage in your application
rauth_session = auth.settings.login_form.rauth_session

---------------------------------------


mic


2013/4/30 Giuseppe Marchetti <[email protected]>

> thanx for ur answer Michele. but i cant run oauth1.0a and oauth2.0 that
> comes with web2py for twitter login. but i found rauth (
> https://github.com/litl/rauth ) it works pretty good. and it s integrated
> with my db. but i cant run login process.. thanx for ur opinion..
>
>
>
> 30 Nisan 2013 Salı 12:34:09 UTC+3 tarihinde Michele Comitini yazdı:
>>
>> You can use oauth1.0a or oauth2 authentication that comes with web2py;
>> see in gluon/contrib/login_methods and the web2py book.
>>
>> mic
>>
>>
>> 2013/4/30 Giuseppe Marchetti <[email protected]>
>>
>>> hi all.. i m new on web2py. i try to get some values from twitter to my
>>> database.. the problem is "i got all values like twitter id, profil pic,
>>> background pic url, friends, fallowers etc. but i cant login"
>>> how can i rise the flag (if there s) auth_user.id_logged_in ?
>>> i mean how can i do that? :
>>> if db.auth_user.id(id) == twitter_id:
>>>     print "logged in"
>>>     (rise login flag)
>>> else:
>>>     redirect('register')
>>>
>>> --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@**googlegroups.com.
>>>
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>>
>>>
>>
>>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to