ITADN

[BUG] 403 error when trying to log in

#310Closedghost 创建于 2025-08-15
bug
G
ghostcommented
Trying to log in with `librespot.core.Session.Builder().oauth().create()` throws this error: ``` Traceback (most recent call last): File "/.../librespot-python/test.py", line 2, in <module> session = Session.Builder().oauth(print).create() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/.../librespot-python/librespot/core.py", line 1677, in create session.authenticate(self.login_credentials) File "/.../librespot-python/librespot/core.py", line 985, in authenticate self.dealer().connect() File "/.../librespot-python/librespot/core.py", line 481, in connect self.__session.tokens().get("playlist-read"), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/.../librespot-python/librespot/core.py", line 2281, in get return self.get_token(scope).access_token ^^^^^^^^^^^^^^^^^^^^^ File "/.../librespot-python/librespot/core.py", line 2301, in get_token response = self._session.mercury().send_sync_json( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/.../librespot-python/librespot/mercury.py", line 186, in send_sync_json raise MercuryClient.MercuryException(response) librespot.mercury.MercuryClient.MercuryException: status: 403 ``` It seems to happen after OAuth login, as a `credentials.json` file is created despite the error, and the error occurs without the OAuth callback if it's retried with the `credentials.json` file present. **To Reproduce** Steps to reproduce the behavior: 1. Run this code: ```python from librespot.core import Session session = Session.Builder().oauth(print).create() ``` 2. Paste the OAuth link into a browser and log in with a valid Spotify account 3. Watch the error happen after logging in **Expected behavior** The login is successful. **Client Information (please complete the following information):** - OS: Linux Mint 22.1 - Python Version: 3.12.3 - Library Version: The latest version from the repo
关闭于 2025-08-15 1 条评论