question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Potential problem in Generic OAuth implementation.

See original GitHub issue

The generic OAuth implementation has the code:

        req = HTTPRequest(url,
                          method=self.userdata_method,
                          headers=headers,
                          validate_cert=self.tls_verify,
                          body=urllib.parse.urlencode({'access_token': access_token})
                          )
        resp = yield http_client.fetch(req)
        resp_json = json.loads(resp.body.decode('utf8', 'replace'))

The userdata_method is set as:

    userdata_method = Unicode(
        os.environ.get('OAUTH2_USERDATA_METHOD', 'GET'),
        config=True,
        help="Userdata method to get user data login information"
    )

The problem is that Tornado implements sanity checks and will error if you try and use GET method where you supply a body for the request. The result is an exception of:

ValueError: Body must be None for method GET (unless allow_nonstandard_methods is true)

The workaround was to set in the configuration userdata_method to POST as the target URL for getting user info must allow both GET and POST.

So this should perhaps default to using POST for userdata_method since is accepted anyway. Alternatively, need to pass allow_nonstandard_methods=True to HTTPRequest class when initialised.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
manicscommented, Oct 13, 2020

Is this still an issue?

0reactions
consideRatiocommented, Oct 25, 2020

@manics I submitted a #376 about the deprecation of the userdata_method, and think we should close this issue no matter what at this point as @minrk fixed the key issue of sending data in a request.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Possible Errors - OAuth 2.0 Simplified
unauthorized_client : The client is not authorized to request an authorization code using this method.
Read more >
OAuth 2.0 Vulnerabilities - Application Security Cheat Sheet
Security issues in the authorization server · Abusing API · Abusing accounts with non-confirmed email · Assignment of accounts based on email address...
Read more >
Solved: Generic Oauth 2 connector not refreshing access or...
When the custom connector isn't connected, it shows the error below. I am not sure if it is an issue or being returned...
Read more >
OAuth Troubleshooting Guide | Atlassian Support
Common OAuth errors with application links. Unrecognized OAuth consumer key; OAuth signature rejected; The system clocks are not synchronized ...
Read more >
Compromising Twitter's OAuth security system
Aside from handling the consumer secret issue poorly, Twitter's OAuth implementation has a number of bugs, defects, and inconsistencies that ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found