-
Notifications
You must be signed in to change notification settings - Fork 211
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
certificate verify failed #47
Comments
Yup I have the same problem. |
Ditto, did you guys have any success figuring this one out? |
My solution is to add additional http options to python-oauth2 and flask-oauth: |
So I was actually able to remedy this by adding more entries to the cacert.txt, per this thread: http://stackoverflow.com/questions/9270195/python-ssl-issue-with-oauth2 Note this appears to be more of an issue for httplib2 than for flask-oauth. |
Hey guys, we just merged some changes in joestump/python-auth2 that should help :) |
In case it helps anyone other than myself. :) Newer versions of urllib2 verify ssl certificates by default. You can override this behavior by monkey patching the http_request method of the flask_oauthlib.client.OAuth class. import ssl
from flask_oauthlib.client import OAuth, prepare_request, http
auth = oauth.remote_app()
def net_http_request(uri, headers=None, data=None, method=None):
'''
Method for monkey patching 'flask_oauthlib.client.OAuth.http_request'
This version allows for insecure SSL certificates
'''
uri, headers, data, method = prepare_request(
uri, headers, data, method
)
req = http.Request(uri, headers=headers, data=data)
req.get_method = lambda: method.upper()
try:
resp = http.urlopen(req, context=ssl._create_unverified_context())
content = resp.read()
resp.close()
return resp, content
except http.HTTPError as resp:
content = resp.read()
resp.close()
return resp, content
auth.http_request = new_http_request |
Thanks @dwoz! it helped to do quick fix just typo: |
I'm using flask_oauth in an app deployed on heroku.
And 'certificate verify failed' occurs when requesting the access token from https://api.weibo.com. But it's ok to access the website in browser, no certificate warning.
So, how can I just ignore the ssl certificate verification?
Stack trace:
The text was updated successfully, but these errors were encountered: