I have a basic linked oauth working. Now it's a question of parsing LinkedIn replies.
thanks for your help C On Oct 12, 10:20 am, Carl <carl.ro...@gmail.com> wrote: > don't know why I didn't upgrade (it's normally the first thing I try) > > 1.86.3 has removed the bug! sorry to have wasted your time. > I'll now have a go at addingLinkedinto your example app. > > C > > On Oct 11, 9:29 pm, Carl <carl.ro...@gmail.com> wrote: > > > > > > > > > I'm on 1.85.3, the same as your example > > I'll update tomorrow to 1.86.3 and see if I get the same behaviour > > > thanks for the help > > > C > > > On 11 October 2010 21:06, Michele Comitini > > <michele.comit...@gmail.com>wrote: > > > > Carl, on 2nd thought... do you have 1.86.3, do you? > > > there was a bug in some erlier version... > > > > 2010/10/11 Carl <carl.ro...@gmail.com>: > > > > 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 havehttp://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 toLinkedinworks 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')