You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to get Client to auto-refresh the token, but stumbled upon a few issues:
Client.from_client_credentials(...).start() raises AuthenticationError. The actual exception is raised inside self._client._http.validate, which can't handle the situation when both token and self.token are None. The fix is easy:
async def validate(self: twitchio.http.TwitchHTTP, *, token: str = None) -> dict:
if not token:
# add these two lines:
if self.token is None:
await self._generate_login()
token = self.token
But even fixing that is not enough: for application tokens (generated by _generate_login) the response of /oauth2/validate does not contain login or user_id - which WSConnection._connect(...) expects.
The text was updated successfully, but these errors were encountered:
I was trying to get Client to auto-refresh the token, but stumbled upon a few issues:
Client.from_client_credentials(...).start()
raisesAuthenticationError
. The actual exception is raised insideself._client._http.validate
, which can't handle the situation when bothtoken
andself.token
areNone
. The fix is easy:_generate_login
) the response of/oauth2/validate
does not containlogin
oruser_id
- whichWSConnection._connect(...)
expects.The text was updated successfully, but these errors were encountered: