Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinkedIn OAuth 2 Tutorial Example - Not working #137

Closed
Michelcyc opened this issue Aug 13, 2014 · 4 comments
Closed

LinkedIn OAuth 2 Tutorial Example - Not working #137

Michelcyc opened this issue Aug 13, 2014 · 4 comments

Comments

@Michelcyc
Copy link

I tried the example and I've got a InsecureTransportError when using the method "fetch_token".
I corrected this error by:

import os
os.environ['DEBUG'] = '1'

Then, I've tried it again and I got a InvalidRequestError this time. My code is exactly like the example.
My call is linkedin.fetch_token(token_url, client_secret=client_secret,authorization_response=redirect_response)

Stack errors:

InvalidRequestError Traceback (most recent call last)
in ()
----> 1 linkedin.fetch_token(token_url, client_secret=client_secret,authorization_response=redirect_response)

/Users/michelsiqueirareis/anaconda/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.pyc in fetch_token(self, token_url, code, authorization_response, body, auth, username, password, **kwargs)
158 r = hook(r)
159
--> 160 self._client.parse_request_body_response(r.text, scope=self.scope)
161 self.token = self._client.token
162 log.debug('Obtained token %s.', self.token)

/Users/michelsiqueirareis/anaconda/lib/python2.7/site-packages/oauthlib/oauth2/rfc6749/clients/web_application.pyc in parse_request_body_response(self, body, scope)
269 .. _Section 7.1: http:https://tools.ietf.org/html/rfc6749#section-7.1
270 """
--> 271 self.token = parse_token_response(body, scope=scope)
272 self._populate_attributes(self.token)
273 return self.token

/Users/michelsiqueirareis/anaconda/lib/python2.7/site-packages/oauthlib/oauth2/rfc6749/parameters.pyc in parse_token_response(body, scope)
302 params['expires_at'] = time.time() + int(params['expires_in'])
303
--> 304 validate_token_parameters(params, scope)
305 return params
306

/Users/michelsiqueirareis/anaconda/lib/python2.7/site-packages/oauthlib/oauth2/rfc6749/parameters.pyc in validate_token_parameters(params, scope)
309 """Ensures token precence, token type, expiration and scope in params."""
310 if 'error' in params:
--> 311 raise_from_error(params.get('error'), params)
312
313 if not 'access_token' in params:

/Users/michelsiqueirareis/anaconda/lib/python2.7/site-packages/oauthlib/oauth2/rfc6749/errors.pyc in raise_from_error(error, params)
229 for _, cls in inspect.getmembers(sys.modules[name], inspect.isclass):
230 if cls.error == error:
--> 231 raise cls(**kwargs)

InvalidRequestError:

This example is 11 months old, maybe something changed and I don't know =/

@ib-lundgren
Copy link
Member

Hi,

Did you have any luck with this? I just ran the example at http:https://requests-oauthlib.readthedocs.org/en/latest/examples/linkedin.html and it worked nicely.

Did you register and submit the same redirect url? Make sure to check trailing /. Try catch the error and print err.json

fyi, 'DEBUG' is transitioning to the more explicit 'OAUTHLIB_INSECURE_TRANSPORT'.

@denibertovic
Copy link

@ib-lundgren i ran the example from the link and when redirected to linkedin I get:

"Error code: ERR_CONTENT_DECODING_FAILED"

@denibertovic
Copy link

Wow this is an unbelievably confusing error message to get for a wrongly copy pasted client_id. The example is working for me now.

@ib-lundgren
Copy link
Member

@denibertovic indeed. Glad you found the error :)

@Michelcyc closing this issue as I am unable to reproduce. Feel free to reopen with reproduction steps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants