ah ha!

I do have a class based on OAuthAccount working but it never occurred
to me to build 'sideways' and plug LinkedIn into my solution.

I'll give it a go. thanks for responding.

On Nov 15, 9:52 pm, Michele Comitini <[email protected]>
wrote:
> Never tested, just a suggestion write something similar in your model
> (see:http://code.google.com/r/michelecomitini-facebookaccess/source/browse...
>
> class LinkedinTest(OAuthAccount):
>     def get_user(self):
>         if self.accessToken() is not None:
>             client = oauth.Client(self.consumer, self.accessToken())
>             resp, content =
> client.request('https://api.linkedin.com/v1/people/~:(id,first-name,last-name)')
>             if resp['status'] != '200':
>                 # cannot get user info. should check status
>                 return None
>             x = dom.parseString(content)
>             firstname = 
> x.getElementsByTagName('first-name')[0].firstChild.data
>             username = firstname + ' '
> +x.getElementsByTagName('last-name')[0].firstChild.data
>             uid = x.getElementsByTagName('id')[0].firstChild.data
>             return dict(username=username, name=firstname, 
> registration_id=uid)
>
> auth.settings.login_form=LinkedinTest(globals(),CLIENT_ID,CLIENT_SECRET,
> AUTH_URL, TOKEN_URL, ACCESS_TOKEN_URL)
>
> api = LinkedIn(api_key, api_secret, callback_url)
>
> api.access_token=auth.settings.login_form.accessToken()
>
> now you should be able to use the linkedin api, skipping the OAuth
> code embedded into it.
>
> 2010/11/15 Carl <[email protected]>:
>
>
>
>
>
>
>
> > Has anyone got gluon/contrib/login_methods/linked_account.py working?
>
> > I've built directly upon /gluon/contrib/login_methods/
> > oauth10a_account.py with my own specific LinkedIn code but having
> > foundhttp://code.google.com/p/python-linkedin/I wanted to use this
> > to avoid reinventing the wheel (Özgür Vatansever's linkedin.py looks
> > clean and has broad support for LinkedIn's API).
>
> > But, linkedin.py doesn't look finished; for example:
> > (from web2py 1.89.1)
>
> > Line 43.
> > result = self.request.vars.verifier
>
> > The vars variable sets 'oauth_verifier' on returning from the LinkedIn
> > website but not 'verifier'.
>
> > Anyone tread this path?

Reply via email to