Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

require_oauth decorator was always succeeding. #5

Merged
merged 1 commit into from

2 participants

@datalogics-kam

verify_request() returns a tuple of (valid, oauth_request). The code was
treating it as if it returned just a bool, and since the never-empty
tuple was always truthy, requests always seemed to work.

Fixes ib-lundgren/flask-oauthprovider/#3

@datalogics-kam datalogics-kam require_oauth decorator was always succeeding.
verify_request() returns a tuple of (valid, oauth_request). The code was
treating it as if it returned just a bool, and since the never-empty
tuple was always truthy, requests always seemed to work.

Fixes ib-lundgren/flask-oauthprovider/#3
5249a17
@ib-lundgren
Owner

Thanks for the PR and sorry for the late reply. Ideally the unpacking would be done directly rather than unpacking but that's just details. Merging.

valid, oauth_request  = self.verify_request(...
@ib-lundgren ib-lundgren merged commit e671925 into ib-lundgren:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 29, 2013
  1. @datalogics-kam

    require_oauth decorator was always succeeding.

    datalogics-kam authored
    verify_request() returns a tuple of (valid, oauth_request). The code was
    treating it as if it returned just a bool, and since the never-empty
    tuple was always truthy, requests always seemed to work.
    
    Fixes ib-lundgren/flask-oauthprovider/#3
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  flask_oauthprovider.py
View
3  flask_oauthprovider.py
@@ -275,7 +275,7 @@ def verify_request(*args, **kwargs):
body = request.form.to_dict()
else:
body = request.data.decode("utf-8")
- valid = self.verify_request(request.url.decode("utf-8"),
+ verify_result = self.verify_request(request.url.decode("utf-8"),
http_method=request.method.decode("utf-8"),
body=body,
headers=request.headers,
@@ -283,6 +283,7 @@ def verify_request(*args, **kwargs):
require_verifier=require_verifier,
require_realm=require_realm or bool(realm),
required_realm=realm)
+ valid, oauth_request = verify_result
if valid:
request.oauth = self.collect_request_parameters(request)
Something went wrong with that request. Please try again.