h-quer / Slaanesh

Slaanesh Game Tracker
GNU General Public License v3.0
68 stars 6 forks source link

Unauthorized IGDB API request #53

Open the-physicser opened 1 week ago

the-physicser commented 1 week ago

Describe the bug Unable to retrieve information from IGDB, with a 401 error, Unauthorized for url: https://api.igdb.com/v4/games

To Reproduce Steps to reproduce the behavior: Create config file, run Slaanesh, and attempt to do something that pulls IGDB data, like matching IDs to names, results in an error

Expected behavior IGDB data is successfully retrieved

System (please complete the following information):

Additional context I've tested using the Auth Token from the config file in my own API request, via PowerShell, and it works, but still not working via Slaanesh.

Error in the logs: Exception in thread Thread-4 (igdb_update_daemon): Traceback (most recent call last): File "/usr/local/lib/python3.12/threading.py", line 1075, in _bootstrap_inner self.run() File "/usr/local/lib/python3.12/threading.py", line 1012, in run self._target(*self._args, **self._kwargs) File "/code/Slaanesh_IGDB.py", line 53, in igdb_update_daemon new_data = collect_game_info(id_tuple) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/code/Slaanesh_IGDB.py", line 83, in collect_game_info name_url_status_release = process_api_data(query_ids(query_str)).rename( ^^^^^^^^^^^^^^^^^^^^ File "/code/Slaanesh_IGDB.py", line 105, in query_ids byte_array = igdb.api_request( ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/igdb/wrapper.py", line 21, in api_request response.raise_for_status() File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.igdb.com/v4/games

h-quer commented 1 week ago

Sorry for the late answer, was a bit busy lately.

Since you mention using the auth token in your own API requests, could it be that you entered the token itself in the config file, and not your client id / client secret? Those are used to create the token and the config file stores those so that Slaanesh can create a new token when the old one expires. Entering the token itself won't work.

After entering client id / client secret in the config file, have you tried to refresh the token manually? There is a UI setting in the admin options (wrench icon in the upper right) -> IGDB section -> refresh access token That should fix things (if client id/secret are set correctly in the config file).

the-physicser commented 1 week ago

No worries!

Nope, I only pulled the auth token to see if it was good. I left the config file at default ( auth token set to "do_not_touch") and it generated a token and filled the config file with it.

I've double checked the client id and secret, and they look accurate, as well.