Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client created with from_client_credentials doesn't work #371

Closed
iarspider opened this issue Dec 27, 2022 · 2 comments
Closed

Client created with from_client_credentials doesn't work #371

iarspider opened this issue Dec 27, 2022 · 2 comments
Labels
2.0 TwitchIO 2.0 wontfix

Comments

@iarspider
Copy link

iarspider commented Dec 27, 2022

I was trying to get Client to auto-refresh the token, but stumbled upon a few issues:

  1. 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
  1. 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.
@github-actions
Copy link

Hello! Thanks for the issue. If this is a general help question, for a faster response consider joining the official Discord Server

Else if you have an issue with the library please wait for someone to help you here.

@IAmTomahawkx
Copy link
Member

This is expected behaviour. You cannot log into chat with a client credential token

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.0 TwitchIO 2.0 wontfix
Projects
None yet
Development

No branches or pull requests

2 participants