sampsyo / wideq

reverse-engineered client for the LG SmartThinQ API
https://pypi.org/project/wideq/
MIT License
331 stars 159 forks source link

Login error #125

Open smarthome-w opened 4 years ago

smarthome-w commented 4 years ago

After command:

python3 example.py -c GB -l gb-GB

I receive link to the login page. After login (empty page, link with redirection in address bar) I've put link into console.

https://gb.m.lgaccount.com/login/iabClose?access_token=<some_token>&refresh_token=<some_token>&oauth2_backend_url=https://gb.lgeapi.com/

After some time I received:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 665, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 376, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 996, in _validate_conn
    conn.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 366, in connect
    self.sock = ssl_wrap_socket(
  File "/usr/lib/python3/dist-packages/urllib3/util/ssl_.py", line 370, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/lib/python3.8/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/usr/lib/python3.8/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1123)
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='eic.lgthinq.com', port=46030): Max retries exceeded with url: /api/member/login (Caused by SSLError(SSLError(1, '[SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1123)')))

Platform: Ubuntu 20.04.

Any ideas?

lucasrosa90 commented 4 years ago

I'm trying to do the login, but I'm redirected to a "Not found" page, with the following link:

pi@raspberrypi:~/homeassistant/config/custom_components/wideq $ sudo python3 example.py -c BR -l pt-BR
Log in here:
https://br.m.lgaccount.com/login/sign_in?country=BR&language=pt-BR&svcCode=SVC202&authSvr=oauth2&client_id=LGAO221A02&division=ha&grant_type=password

Then paste the URL where the browser is redirected:
**https://br.m.lgaccount.com/login/iabClose/thirdpartylogin?third_party_type=GGL&front_url=https://br.m.lgaccount.com/login/sign_in?country=BR&language=pt-BR&svcCode=SVC202&authSvr=oauth2&client_id=LGAO221A02&onyx_feature=N&division=ha&show_select_country=N&show_add_services=N&oauthTokenExpiredFlag=N&globalFacebook=false&globalGoogle=false&os_type=PC**
Traceback (most recent call last):
  File "example.py", line 296, in <module>
    main()
  File "example.py", line 292, in main
    example(args.country, args.language, args.verbose, args.cmd, args.args)
  File "example.py", line 228, in example
    client._auth = authenticate(client.gateway)
  File "example.py", line 27, in authenticate
    return wideq.Auth.from_url(gateway, callback_url)
  File "/home/pi/homeassistant/config/custom_components/wideq/wideq/core.py", line 354, in from_url
    access_token, refresh_token = parse_oauth_callback(url)
  File "/home/pi/homeassistant/config/custom_components/wideq/wideq/core.py", line 244, in parse_oauth_callback
    return params['access_token'][0], params['refresh_token'][0]
KeyError: 'access_token'
pifou25 commented 4 years ago

Hi, some already had SSL errors, such as the DH KEY TOO SMALL (message with debian, but ubuntu should be the same I presume) https://github.com/sampsyo/wideq/issues/104