3

I am trying to connect to LinkedIn using the OAuth2Service provided by rauth. I successfully retrieve the access token. To do so, I configured a specific decoder for the json response.

json_decoder = json.loads
params = {'decoder': json_decoder}
session = linkedin.get_auth_session(data=data, **params)

But when doing the API call via r = session.get('people/~', data={"x-li-format":'json'},) the following response is coming back:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>
  <status>401</status>
  <timestamp>1369334215190</timestamp>
  <request-id>F3SKIP4YUF</request-id>
  <error-code>0</error-code>
  <message>Unknown authorization header {Bearer AQU2HxhdXVHGG4sIWdZV7siahjVyTz0KIigEVvtMpAh...}
</message>
</error>

Is it possible that LinkedIn does not support the bearer token? If so, does rauth support other schemes?

t_-_t
  • 138
  • 2
  • 6
  • 2
    `r = session.get('people/~', data={'x-li-format': 'json'}, bearer_auth=False)` – maxcountryman May 23 '13 at 19:32
  • thanks! `r = session.get('people/~?format=json&oauth2_access_token='+str(session.access_token), data={'x-li-format': 'json'}, bearer_auth=False)` did the trick. the `data={}` does however not translate in the header being added. Any idea? – t_-_t May 24 '13 at 00:01
  • "the data={} does however not translate in the header being added." I don't know what you mean by this. – maxcountryman May 24 '13 at 01:10
  • Hey @t_-_t , I've managed to get the authorization_code, but when I'm trying to get the access_token, I keep getting a 'client unauthorized' error... /: Could you please share share the code that gets the access_token? Pretty please with a cherry on top... :P – Alex Zak Jul 20 '13 at 14:46

1 Answers1

3

Rauth supports turning off the default header-based authentication by passing in bearer_auth=False, see the documentation. This should correct problems with misbehaving providers that either don't support header-based authentication or implement it improperly. Hope that helps!

maxcountryman
  • 1,562
  • 1
  • 24
  • 51