ah! Mic's Twitter example was *very* useful.
Running web2py.py from a command line (on Win7HE) worked a treat but launching from within Eclipse (Helios) failed to return from Twitter. Why... well the 'return url' sent to twitter had the port number duplicated. So instead of http://127.0.0.1:8000/helloTwitter/default/home_timeline we have http://127.0.0.1:8000:8000/helloTwitter/default/home_timeline and of course that :8000:8000 means that the browser's redirecting nowhere fast. Twitter displays the return URL making it easy to diagnose. Linkedin does not so I had gotten stuck. So similarly, my round-trip to Linkedin works when running from a command line but not from within Eclipse. The duplicate port number happens in gluon/contrib/login_methods/ oauth10a_account.py in __redirect_uri() The line "if not http_host: http_host=r.env.http_host" retrieves a host name including a port number. The line url_port = ':' + r.env.server_port adds the port number again. The headache is: why does this happen within Eclipse but not from a command-line? Does anyone know the cure for this headache? On Oct 9, 8:15 pm, Carl Roach <carl.ro...@gmail.com> wrote: > Thanks Mic; looks and sounds really useful > > On 9 Oct 2010, at 18:23, Michele Comitini <michele.comit...@gmail.com> wrote: > > > > > > > > > You can try with oauth10a_account.py login method, it should work. I > > did not have time yet to put an example application on line, > > but it is very similar to twitter. > > >http://code.google.com/r/michelecomitini-facebookaccess/source/browse... > > > I will put thelinkedinexample online soon... > > > mic > > > 2010/10/9CarlRoach <carl.ro...@gmail.com>: > >> Thanks M. I'll look into that but I will need full access toLinkedIn(name, > >> company, contacts) > > >> I'm nearly there it's just the vague error message that had me stumped :) > > >> On 9 Oct 2010, at 04:18, mdipierro <mdipie...@cs.depaul.edu> wrote: > > >>> If you only need authentication you may want to consider using rpx as > >>> shown in this video: > > >>>http://vimeo.com/13485916 > > >>> On Oct 8, 7:36 pm,Carl<carl.ro...@gmail.com> wrote: > >>>> I've been following the instructions > >>>> athttp://code.google.com/p/python-linkedin/ > >>>> to addlinkedinauthentication. I grabbed the latest revision (#20) > >>>> from svn. > > >>>> I've started by creating a new app (and called it oauth) within web2py > >>>> to keep things simple. > > >>>> Into default.py I've added the following functions (and I've defined > >>>> my own KEY and SECRET in db.py). When I > >>>> enterhttp://127.0.0.1:8000/oauth/default/linkedin > >>>> I am redirected to theLinkedInwebsite where I can give permission to > >>>> log in. Once I do that I am redirected > >>>> tohttp://127.0.0.1:8000/oauth/default/profile/ > >>>> Here I can retrieve request.vars.oauth_verifier for a call to > >>>> api.accessToken(). however, the return value is False and a call to > >>>> api.getRequestTokenError() returns "permission_unknown". I can't find > >>>> out what is causing this error. > > >>>> Any ideas? > > >>>> deflinkedin(): > >>>> RETURN_URL = "http://127.0.0.1:8000/oauth/default/profile/" > >>>> import gluon.contrib.login_methods.linkedin > >>>> from gluon.contrib.login_methods.linkedinimportLinkedIn > >>>> api =LinkedIn(KEY, SECRET, RETURN_URL) > >>>> token = api.requestToken() > >>>> if not api.getRequestTokenError(): > >>>> u = api.getAuthorizeURL(request_token=api.request_token) > >>>> redirect(u) > >>>> return dict(message=T('Hello World'),token=token, > >>>> request_token=api.request_token, > >>>> token_secret=api.request_token_secret) > > >>>> def profile(): > >>>> oauth_token = request.vars.oauth_token > >>>> oauth_verifier = request.vars.oauth_verifier > > >>>> RETURN_URL = "http://127.0.0.1:8000/oauth/default/more/" > >>>> import gluon.contrib.login_methods.linkedin > >>>> from gluon.contrib.login_methods.linkedinimportLinkedIn > >>>> api =LinkedIn(KEY, SECRET, RETURN_URL) > >>>> token = api.requestToken() > >>>> result = api.accessToken(verifier=oauth_verifier) > >>>> profile = None > >>>> if result: > >>>> profile = api.GetProfile(url='http://www.linkedin.com/in/ > >>>> carlroach') > >>>> else: > >>>> print api.getRequestTokenError() > > >>>> return dict(message=T('Profile info'), profile=profile) > > >>>> def more(): > >>>> return dict(message='more')