Description
Summary
The problem that I am having is showing up after user enters their credentials at the Auth0's lock screen. When I looked at Auth0 Dashboard's log section I can see users can login successfully ( I see both Success Exchange, Success Login ). Then call back function is triggering the callback call. At that point production and test(localhost) environments differs from each other.
In localhost I can see the status code 302 Found status code on the localhost but not in the production server. In production server I am seeing the status code 500 INTERNAL SERVER ERROR.
When I checked the server side I saw it was failing at the token line of the callback function
@app.route('/callback')
def callback_handling():
code = request.args.get('CODE_KEY')
get_token = GetToken('AUTH0_DOMAIN')
auth0_users = Users('AUTH0_DOMAIN')
token = get_token.authorization_code('AUTH0_CLIENT_ID'], ['AUTH0_CLIENT_SECRET', code, 'AUTH0_CALLBACK_URL') # FAILING HERE #
user_info = auth0_users.userinfo(token['access_token'])
.....
...
..
return redirect('/some_path')
When I checked the credentials they all look what they are supposed to be. So in the server logs I am seeing this keywords in the servers.
ERROR in app: Exception on /callback
raise SSLError(e, request=request)
SSLError: HTTPSConnectionPool(host='my_domain.auth0.com', port=443): Max retries exceeded with url: /oauth/token (Caused by SSLError(SSLError('bad handshake: SysCallError(0, None)',),))
I am thinking server might be rejecting the certificate or something and after seeing this link thought opening issue might be helpful.
Ubuntu 16.04, Python 2.7.12, certifi 2017.7.27.1
Expected Result
In the callback function returns token
token = get_token.authorization_code('AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', code, 'AUTH0_CALLBACK_URL')
Actual Result
SSLError: HTTPSConnectionPool(host='my_domain.auth0.com', port=443): Max retries exceeded with url: /oauth/token (Caused by SSLError(SSLError('bad handshake: SysCallError(0, None)',
Reproduction Steps
import requests
System Information
$ python -m requests.help
python -m requests.help
{
"chardet": {
"version": "3.0.4"
},
"cryptography": {
"version": "1.2.3"
},
"idna": {
"version": "2.6"
},
"implementation": {
"name": "CPython",
"version": "2.7.12"
},
"platform": {
"release": "3.13.0-43-generic",
"system": "Linux"
},
"pyOpenSSL": {
"openssl_version": "1000207f",
"version": "0.15.1"
},
"requests": {
"version": "2.18.4"
},
"system_ssl": {
"version": "1000207f"
},
"urllib3": {
"version": "1.22"
},
"using_pyopenssl": true
}
This command is only available on Requests v2.16.4 and greater. Otherwise,
please provide some basic information about your system (Python version,
operating system, &c).
Activity
[-]SSLError: HTTPSConnectionPool(host='oraclis.auth0.com', port=443): Max retries exceeded with url: /oauth/token (Caused by SSLError(SSLError('bad handshake: SysCallError(0, None)',),))[/-][+]SSLError: HTTPSConnectionPool(host='mydomain.auth0.com', port=443): Max retries exceeded with url: /oauth/token (Caused by SSLError(SSLError('bad handshake: SysCallError(0, None)',),))[/+][-]SSLError: HTTPSConnectionPool(host='mydomain.auth0.com', port=443): Max retries exceeded with url: /oauth/token (Caused by SSLError(SSLError('bad handshake: SysCallError(0, None)',),))[/-][+]SSLError HTTPSConnectionPool Max retries exceeded with url: /oauth/token Caused by SSLError('bad handshake: SysCallError(0, None))[/+]Lukasa commentedon Aug 18, 2017
Thanks for this report! I think we need to see a bit more of the actual Requests code. It seems like the server is rejecting the handshake but it's hard to know more without seeing your requests call.
albayraktaroglu commentedon Aug 18, 2017
Hi Lukasa,
The code below is being called by
token = get_token.authorization_code('AUTH0_CLIENT_ID'], ['AUTH0_CLIENT_SECRET', code, 'AUTH0_CALLBACK_URL')
function which is located in my callback function.More deeper
Closer look to exception's traceback
Any thoughts?
Thanks
Lukasa commentedon Aug 18, 2017
Hrm, it's not super apparent what's happening here.
SysCallError
is an odd one, but I suspect this is the result of the TLS connection being shut down. Are you familiar enough with Wireshark or tcpdump to get me a packet capture of the connection attempt?albayraktaroglu commentedon Aug 18, 2017
Problem solved! I was thinking that is something related with certificates and started to look into
certifi
in the beginning but problem is aboutpyOpenSSL
when I compared the local and productionpyOpenSSL
versions, saw big version gap. Steps we followeduninstalled pyOpenSSL-0.15.1
installed pyOpenSSL-17.2.0 (the latest version)
and it works now. Thank you for all your assistance. You can mark issue as solved 😄
Lukasa commentedon Aug 18, 2017
Thanks!
iamaziz commentedon Jan 9, 2018
@albayraktaroglu thanks :)!
It was solved by
pip install -U pyopenssl
Install pyOpenSSL for httpie test
Install pyOpenSSL for httpie test
Install pyOpenSSL for httpie test
Install pyOpenSSL for httpie test
x0rw commentedon Apr 5, 2020
EZ
use and randomize proxies
ShararAwsaf commentedon May 14, 2020
https://stackoverflow.com/q/24323858/13476428
This solution fixed the issue by syncing the openssl versions
if
--with-brewd-openssl
doesn't work try uninstalling python and then install openssl and reinstall python with homebrew with steps mentioned in the link
RaviFefar commentedon Aug 31, 2020
Just use verify=False to ignore the SSL.
abhijeetmane21 commentedon Sep 14, 2020
@albayraktaroglu The solution is not working for me. i have upgraded to 18.0.0 but still getting error.
maldil commentedon Sep 19, 2020
@albayraktaroglu Same story. Upgrading
pyopenssl
does not works for me. 👎ShararAwsaf commentedon Sep 19, 2020
See my comment on May 14th.
From what I get Python needs to reference the right version of openssl. To ensure that I uninstalled both python and openssl and followed the link for reinstallation