apastel / ytmusic-deleter

Easily delete your YouTube Music library.
GNU General Public License v3.0
109 stars 7 forks source link

Can't login #74

Closed razorsoup closed 1 month ago

razorsoup commented 1 month ago

Installed the application without error but clicking the sign-in button doesn't do anything. The log found in the AppData folder contains the following:

[2024-09-27 13:49:18] Click the 'Sign In' button to connect to your account.
[2024-09-27 13:49:18] GUI version: 2.6.2
[2024-09-27 13:49:18] CLI path: C:\Program Files (x86)\YTMusic_Deleter\_internal\ytmusic-deleter.EXE
[2024-09-27 13:49:20] CLI version: ytmusic-deleter, version 2.6.2
[2024-09-27 13:49:20] ytmusicapi version: 1.8.1
[2024-09-27 13:49:22] Unhandled exception occurred
Traceback (most recent call last):
  File "urllib3\connectionpool.py", line 715, in urlopen
  File "urllib3\connectionpool.py", line 404, in _make_request
  File "urllib3\connectionpool.py", line 1060, in _validate_conn
  File "urllib3\connection.py", line 419, in connect
  File "urllib3\util\ssl_.py", line 449, in ssl_wrap_socket
  File "urllib3\util\ssl_.py", line 493, in _ssl_wrap_socket_impl
  File "ssl.py", line 455, in wrap_socket
  File "ssl.py", line 1042, in _create
  File "ssl.py", line 1320, in do_handshake
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "requests\adapters.py", line 667, in send
  File "urllib3\connectionpool.py", line 801, in urlopen
  File "urllib3\util\retry.py", line 594, in increment
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.youtube.com', port=443): Max retries exceeded with url: /o/oauth2/device/code (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 246, in prompt_for_auth
  File "ytmusicapi\auth\oauth\credentials.py", line 78, in get_code
  File "ytmusicapi\auth\oauth\credentials.py", line 85, in _send_request
  File "requests\sessions.py", line 637, in post
  File "requests\sessions.py", line 589, in request
  File "requests\sessions.py", line 703, in send
  File "requests\adapters.py", line 698, in send
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.youtube.com', port=443): Max retries exceeded with url: /o/oauth2/device/code (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')))

I suspect it's due to the content filter that is in use on this network but wanted to get your thoughts on this error as well. My workstation is supposed to be unfiltered but this error seems to suggest an issue with making an SSL connection, right?

apastel commented 1 month ago

Yikes, never seen that one in the context of this application before. It's trying to reach out to YouTube's authentication endpoint, and the request library is saying that it doesn't have proper certificate for that site and therefore it doesn't trust it and won't make the connection. But "youtube.com" is a generally trusted site and I'm 100% sure the requests library already has the proper certificates for it, so this does kinda seem like a specific environmental issue like you suspected.

Programmatically the way to fix this is to disable SSL verification, but requires actually modifying the code of the application, and not even the code of THIS application, it would be the code of the ytmusicapi application that this app depends on, so it's even one level deeper. So that's kinda out of the question.

I think you probably wouldn't run into this issue if you used the CLI version of ytmusic-deleter. It's not as glamarous as the graphical user interface, and it requires being comfortable using a command line interface. But it would probably work since it would outsource the authentication to your browser instead of the Python requests API that is currently failing for you.

CLI README: https://github.com/apastel/ytmusic-deleter/blob/main/ytmusic_deleter/README.md

I'll let you know if I think of anything else though. If you can get on a Windows computer on a different network, that should work too!

razorsoup commented 1 month ago

Verified that it works on a different computer.