You also need this: https://pypi.python.org/pypi/oauth2
2013/12/5 Michele Comitini <[email protected]> > I have this old code that should work in db.py: > > auth_table = db.define_table( > auth.settings.table_user_name, > Field('first_name', length=128, default=""), > Field('last_name', length=128, default=""), > Field('username', length=128, default="", unique=True), > Field('password', 'password', length=256, > readable=False, label='Password'), > Field('registration_key', length=128, default= "", > writable=False, readable=False)) > > auth_table.username.requires = IS_NOT_IN_DB(db, auth_table.username) > > import twitter_oauth_data as toa # a file under > modules/twitter_oauth_data.py containing token_url, auth_url, client_id, > client_secret > > CLIENT_ID=toa.CLIENT_ID > CLIENT_SECRET=toa.CLIENT_SECRET > AUTH_URL=toa.AUTH_URL > TOKEN_URL=toa.TOKEN_URL > ACCESS_TOKEN_URL=toa.ACCESS_TOKEN_URL > from gluon.contrib.login_methods.oauth10a_account import OAuthAccount > import oauth2 as oauth > import gluon.contrib.simplejson as json > class TwitterAccount(OAuthAccount): > def get_user(self): > if self.accessToken() is not None: > client = oauth.Client(self.consumer, self.accessToken()) > resp, content = client.request(' > http://api.twitter.com/1/account/verify_credentials.json') > if resp['status'] != '200': > # cannot get user info. should check status > return None > u = json.loads(content) > return dict(username=u['screen_name'], name=u['name'], > registration_id=u['id']) > > > auth.settings.actions_disabled=['register','change_password','request_reset_password','profile'] > auth.settings.login_form=TwitterAccount(globals(),CLIENT_ID,CLIENT_SECRET, > AUTH_URL, TOKEN_URL, ACCESS_TOKEN_URL) > > > > 2013/12/4 Cássio Botaro <[email protected]> > >> What's the way to do login with twitter without using janrain? I've tried >> this solution but only works with facebook. >> https://github.com/r4bugento/web2social >> >> After authorization, I've been redirected to >> http://127.0.0.1:8000/web2social/default/user/login and show me this >> message: "This webpage has a redirect loop" >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> 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. >> > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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.

