Skip to content
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

Stuck at "SmartThinQ LGE Sensors - Authentication Page #99

Closed
gravyflex opened this issue Oct 12, 2020 · 18 comments
Closed

Stuck at "SmartThinQ LGE Sensors - Authentication Page #99

gravyflex opened this issue Oct 12, 2020 · 18 comments

Comments

@gravyflex
Copy link

I am stuck at the following screen.
image

I am using https://sso.lg.com/oauth/page/login?authorizeKey=c65a6479-0993-4939-a954-39f2bf38ea36 as the URL and
The redirection URL for me is: https://www.lg.com/ca_en/mylg. I am sure I am missing something...

@KTibow
Copy link
Contributor

KTibow commented Oct 13, 2020

You're supposed to paste in the URL in the empty field, not the filled in one.

@gravyflex
Copy link
Author

Like this?
image

When I hit submit, it goes to the first screenshot I posted.

@KTibow
Copy link
Contributor

KTibow commented Oct 13, 2020

You need to copy the page, log in to your LG account, and copy the result back in. Make sure you can access ThinQ via the app, and there aren't any updates to the app. If there are, install them, and log in to the app.

@gravyflex
Copy link
Author

I can confirm that I am able to:
(1) log into my LG account successfully
(2) The ThinQ app is at the latest version

image
image

I have repeated the steps you outlined above a few times with the same result. So If I am following the instructions correctly I might be missing something. 🤔

@KTibow
Copy link
Contributor

KTibow commented Oct 13, 2020

Screenshot of you logging in to LG?

@gravyflex
Copy link
Author

Please see requested screenshots below:
image
image

Also when the SmartThinQ LGE Sensors - Authentication dialogue loads in HA, should the SmartThinQ login URL field auto-populate a URL? In my case, it does not and I wanted to also confirm that this is the expected behavior.

@KTibow
Copy link
Contributor

KTibow commented Oct 13, 2020

Nope, for me it goes to something like localhost/auth?code=isodjfdruijgidjinji. That shouldn't happen.

@KTibow
Copy link
Contributor

KTibow commented Oct 13, 2020

I think LG recently changed their auth system. Make sure your region is correct.

@gravyflex
Copy link
Author

I think my region (CA) is correct. Additionally, I tried US and AU just to see if the SmartThinQ LGE Sensors - Authentication dialogue would load the URL. It did not.

@KTibow
Copy link
Contributor

KTibow commented Oct 13, 2020

Try manually getting an auth token.

@gravyflex
Copy link
Author

I was able to login using example.py https://github.com/sampsyo/wideq.

After running python3 example.py --country CA --language en-CA I got the log in link and when I paste the redirected url there was no errors. example ls does not show my only device but that could be due the api2.

@ollo69
Copy link
Owner

ollo69 commented Oct 14, 2020

I'm not understanding from were your login URL shown in your screenshot that start with "sso" (that probably means single sign on) come from. I just tried now using country = CA and language = en and the login URL returned by integration is:

https://ca.m.lgaccount.com/spx/login/signIn?country=CA&language=en-CA&svc_list=SVC202&client_id=LGAO221A02&division=ha&redirect_uri=https%3A%2F%2Fkr.m.lgaccount.com%2Flogin%2FiabClose&state=99139cfe0dfe11ebbc380242ac110002&show_thirdparty_login=GGL%2CAMZ%2CFBK

My be you have installed some other integration that cause some conflict?

@KTibow
Copy link
Contributor

KTibow commented Oct 14, 2020

You need to copy the filled-in field over to a new tab.

@gravyflex
Copy link
Author

I'm not understanding from were your login URL shown in your screenshot that start with "sso" (that probably means single sign on) come from. I just tried now using country = CA and language = en and the login URL returned by integration is:

That 'sso' URL I posted before is a red herring at this point. I had copied it from my browser as the SmartThinQ LGE Sensors - Authentication dialogue in the HA integration is not populating a url for me which is the issue.

When I tried logging in with wideq, I can see the url.

python3 example.py --country CA --language en-CA
Log in here:
https://ca.m.lgaccount.com/login/sign_in?country=CA&language=en-CA&svcCode=SVC202&authSvr=oauth2&client_id=LGAO221A02&division=ha&grant_type=password
Then paste the URL where the browser is redirected: 

@ollo69
Copy link
Owner

ollo69 commented Oct 14, 2020

Do you see some error in the HA log? It's really strange that the URL is not populated, so I need the log to understand what's going wrong. Should be better if you can enable debug log for the component.
The URL provided by WideQ library is APIv1 based so is not usable for the component that use APIv2

@KTibow
Copy link
Contributor

KTibow commented Oct 14, 2020

Can you post a screenshot of the dialog before you go to that URL?

@gravyflex
Copy link
Author

OMG it's my firewall!! I am logged in now. Thanks for the help and patience.

requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='route.lgthinq.com', port=46030)

Log entry:

2020-10-14 15:57:00 DEBUG (SyncWorker_10) [custom_components.smartthinq_sensors.wideq.core_v2] thinq2_get before: https://route.lgthinq.com:46030/v1/service/application/gateway-uri
2020-10-14 15:57:21 ERROR (SyncWorker_10) [custom_components.smartthinq_sensors] Error retrieving login URL from ThinQ
Traceback (most recent call last):
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/urllib3/connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/urllib3/connectionpool.py", line 381, in _make_request
    self._validate_conn(conn)
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/urllib3/connectionpool.py", line 978, in _validate_conn
    conn.connect()
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/urllib3/connection.py", line 309, in connect
    conn = self._new_conn()
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/urllib3/connection.py", line 164, in _new_conn
    raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x7f0b905ceee0>, 'Connection to route.lgthinq.com timed out. (connect timeout=10)')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/urllib3/connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/urllib3/util/retry.py", line 439, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='route.lgthinq.com', port=46030): Max retries exceeded with url: /v1/service/application/gateway-uri (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f0b905ceee0>, 'Connection to route.lgthinq.com timed out. (connect timeout=10)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/hass/.homeassistant/custom_components/smartthinq_sensors/__init__.py", line 103, in getLoginUrl
    login_url = client.gateway.oauth_url()
  File "/home/hass/.homeassistant/custom_components/smartthinq_sensors/wideq/core_v2.py", line 600, in gateway
    self._gateway = Gateway.discover(self._country, self._language)
  File "/home/hass/.homeassistant/custom_components/smartthinq_sensors/wideq/core_v2.py", line 292, in discover
    gw = gateway_info(country, language)
  File "/home/hass/.homeassistant/custom_components/smartthinq_sensors/wideq/core_v2.py", line 206, in gateway_info
    return thinq2_get(V2_GATEWAY_URL, country=country, language=language)
  File "/home/hass/.homeassistant/custom_components/smartthinq_sensors/wideq/core_v2.py", line 129, in thinq2_get
    res = requests.get(
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/requests/api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/opt/homeassistant/hass/lib/python3.8/site-packages/requests/adapters.py", line 504, in send
    raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='route.lgthinq.com', port=46030): Max retries exceeded with url: /v1/service/application/gateway-uri (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f0b905ceee0>, 'Connection to route.lgthinq.com timed out. (connect timeout=10)'))

@KTibow
Copy link
Contributor

KTibow commented Oct 14, 2020

Consider closing then?

ollo69 added a commit that referenced this issue Oct 15, 2020
- added error in config flow when login URL is not returned (issue #99)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants