tybug / ossapi

The definitive python wrapper for the osu! api.
https://tybug.github.io/ossapi/
GNU Affero General Public License v3.0
80 stars 17 forks source link

oauthlib.oauth2.rfc6749.errors.InvalidClientError: (invalid_client) Client authentication failed #68

Closed SussyGuy35 closed 1 year ago

SussyGuy35 commented 1 year ago

i got an error (as the title) i use ossapi for my discord bot it run fine for 4 months until now when i restart the bot, i got this error

tybug commented 1 year ago

can you post your ossapi version (pip list | grep ossapi) along with the full error stacktrace if possible?

SussyGuy35 commented 1 year ago

ossapi version 3.3.2 full error stacktrace:

Traceback (most recent call last):
  File "C:\Users\BachNob\open-susbot\susbot.py", line 22, in <module>
    ossapi_client = commands.osu.client(OSUAPI_CLIENT_ID,OSUAPI_CLIENT_SECRET)
  File "C:\Users\BachNob\open-susbot\commands\osu.py", line 4, in client
    osu_api = Ossapi(OSUAPI_CLIENT_ID, OSUAPI_CLIENT_SECRET)
  File "C:\Users\BachNob\AppData\Local\Programs\Python\Python310\lib\site-packages\ossapi\ossapiv2.py", line 397, in __init__
    self.session = self.authenticate(token=token)
  File "C:\Users\BachNob\AppData\Local\Programs\Python\Python310\lib\site-packages\ossapi\ossapiv2.py", line 477, in authenticate
    return self._new_client_grant(self.client_id, self.client_secret)
  File "C:\Users\BachNob\AppData\Local\Programs\Python\Python310\lib\site-packages\ossapi\ossapiv2.py", line 489, in _new_client_grant
    token = session.fetch_token(token_url=self.token_url,
  File "C:\Users\BachNob\AppData\Local\Programs\Python\Python310\lib\site-packages\requests_oauthlib\oauth2_session.py", line 366, in fetch_token
    self._client.parse_request_body_response(r.text, scope=self.scope)
  File "C:\Users\BachNob\AppData\Local\Programs\Python\Python310\lib\site-packages\oauthlib\oauth2\rfc6749\clients\base.py", line 427, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)
  File "C:\Users\BachNob\AppData\Local\Programs\Python\Python310\lib\site-packages\oauthlib\oauth2\rfc6749\parameters.py", line 441, in parse_token_response
    validate_token_parameters(params)
  File "C:\Users\BachNob\AppData\Local\Programs\Python\Python310\lib\site-packages\oauthlib\oauth2\rfc6749\parameters.py", line 448, in validate_token_parameters
    raise_from_error(params.get('error'), params)
  File "C:\Users\BachNob\AppData\Local\Programs\Python\Python310\lib\site-packages\oauthlib\oauth2\rfc6749\errors.py", line 399, in raise_from_error
    raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidClientError: (invalid_client) Client authentication failed
SussyGuy35 commented 1 year ago

first got error i was using ossapi 3.2.1 tried update ossapi to 3.3.2, restart my host, even change to a new osu api v2 client no thing worked

tybug commented 1 year ago

can you go to https://osu.ppy.sh/home/account/edit#oauth and triple check that the client id and secret you are using are listed under "own clients", and you haven't deleted this client at some point?

We have had issues before with long-running sessions failing reauthentication, but the stacktrace you posted suggests this is an issue with your specific client id or secret instead.

SussyGuy35 commented 1 year ago

oh im just realise that i got a typo in client secret sorry

tybug commented 1 year ago

glad to hear that!