Hi, About the exception:
I changed the Field name to "oauth_uid". I did not notice this problem because i'm using GAE. About "*App does not exist or you are not authorized*": This means that your oauth key/secret is not properly set in your configuration. You are not supplying a valid/authorized oauth client key to the provider. Which provider is giving this message? What does your configuration look like? What is find strange is that that plugin packed/installed by yourself is giving different result than te one installed manually. This should be exactly the same right? Are you sure everything is included in the one packed by yourself? Regards, Quint On Saturday, February 22, 2014 4:15:11 AM UTC+1, James Q wrote: > > Interesting plugin, thanks for the link. > > I took that repository, tar'ed and gzip'ed it, and uploaded it as a > plugin. Says "App does not exist or you are not authorized". No idea what > that means, so I did it manually in a new app called oauth. Here is what I > get as an exception when trying to open up the new app: > > Traceback (most recent call last): > File "/home/james/Development/web2py/gluon/restricted.py", line 217, in > restricted > exec ccode in environment > File > "/home/james/Development/deemok-web2py/applications/oauth/models/plugin_social_auth.py" > <http://127.0.0.1/admin/edit/oauth/models/plugin_social_auth.py>, line 7, in > <module> > Field('user', 'reference auth_user', writable=False, notnull=True)) > File "/home/james/Development/web2py/gluon/dal.py", line 8139, in > define_table > table = self.lazy_define_table(tablename,*fields,**args) > File "/home/james/Development/web2py/gluon/dal.py", line 8156, in > lazy_define_table > table = table_class(self, tablename, *fields, **args) > File "/home/james/Development/web2py/gluon/dal.py", line 8665, in __init__ > check_reserved(field_name) File > "/home/james/Development/web2py/gluon/dal.py", line 7850, in > check_reserved_keyword > 'invalid table/column name "%s" is a "%s" reserved SQL/NOSQL keyword' % > (name, backend.upper())) > SyntaxError: invalid table/column name "uid" is a "ALL" reserved SQL/NOSQL > keyword > > Can you possibly rename the field: > > Field('uid', 'string', notnull=True, writable=False, length=255), > > to: > > Field('oauth_uid', 'string', notnull=True, writable=False, length=255), > > Or something along those lines? > > > > > > On Friday, February 21, 2014 3:55:00 AM UTC-5, Quint wrote: >> >> Hi, >> >> You could have a look at >> python-social-auth<https://github.com/omab/python-social-auth> and >> if you like it and don't know how to integrate it, have a look at this >> plugin <https://code.google.com/p/w2p-social-auth/> to integrate it in >> web2py. >> >> >> Quint >> >> On Wednesday, February 19, 2014 12:33:29 AM UTC+1, James Q wrote: >> >>> I have a feeling that this topic comes up often, but I cannot seem to >>> Google a good solution to this. Essentially, I want users to be able to >>> login using either the built in Auth, or login via some Oauth provider, >>> like Twitter and Facebook. I have seen previous solutions using >>> ExtendedLoginForm and custom Twitter classes that inherit from >>> OAuthProvider, but they no longer seem to work. The Twitter code I find no >>> longer supports the newest Twitter API; the linkedin code from the web2py >>> book also does not work. >>> >>> Here is sample code I have now, which only seems to constantly redirect >>> me to the logout page: >>> >>> 1) Created new web2py application by copying the welcome one to a folder >>> named 'oauth' >>> 2) Added this code to db.py (taken from multiple examples online): >>> >>> from gluon.contrib.login_methods.oauth10a_account import OAuthAccount >>> from oauth2 import Client, Consumer, Token >>> >>> class TwitterAccount(OAuthAccount): >>> AUTH_URL = "http://twitter.com/oauth/authorize" >>> TOKEN_URL = "https://twitter.com/oauth/request_token" >>> ACCESS_TOKEN_URL = "http://twitter.com/oauth/access_token" >>> CLIENT_ID = "..." >>> CLIENT_SECRET = "..." >>> >>> def __init__(self, g): >>> OAuthAccount.__init__(self, g, self.CLIENT_ID, >>> self.CLIENT_SECRET, self.AUTH_URL, self.TOKEN_URL, self.ACCESS_TOKEN_URL) >>> >>> def get_user(self): >>> if self.accessToken() is not None: >>> consumer = Consumer(key=self.CLIENT_ID, >>> secret=self.CLIENT_SECRET) >>> client = Client(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 >>> #redirect("http://google.com") >>> return None >>> u = json.loads(content) >>> return dict(first_name = u['name'], >>> username=u['screen_name'], name=u['name'], registration_id=u['id']) >>> >>> auth.settings.login_form=TwitterAccount(g=globals()) >>> >>> 3) Going to 127.0.0.1/oauth/user/login redirects me to user/logout. >>> >>> >>> Besides my frustration in trying to find timely information about this, >>> is there working code out there that is *recent*, in that it works with >>> latest web2py and the latest Oauth implementations? I'd really appreciate >>> any tips or hints anyone has. >>> >>> >>> -- 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.

