Unable Generate User Access Token via TwtichCLI , results are simply empty

After properly configuring application (“http://localhost”) and using TwitchCLI console command for user scope token

twitch token -u -s “chat:read”

I do get the browser to redirect to authorize via twitch (and I do)

and this is the result, an empty result:

2024/06/27 18:10:26 Waiting for authorization response ...
2024/06/27 18:10:27 Closing local server ...
2024/06/27 18:10:28 User Access Token:
Refresh Token:
Expires At: 2024-06-28 01:10:28.623112 +0000 UTC
Scopes: []

In other words, the process completes with no result that can be used as a token. (the message received is just empty)

Is this a new problem?

The redirect for the cli is localhost:3000 iirc not straight localhost

And then something is hitting localhost causing empty/faulted generation

I’m not sure this is suggesting a solution on my end, or Twitch’s.

I have (again) tried “:3000”, but it makes no difference.

Yes, I agree, “something” is causing empty token generation, yet the process is completing in TwtichCLI. So, is there anything to be done from my end, or is this a problem we’re promoting to be addressed on the Twitch side?

(SOLUTION) Let’s just say, maybe TwitchCLI and this entire route to gain tokens is one way to provide access to your application, but there are other simpler ways.

As the issue describes, I was just trying to read the irc chat from a Twitch channel. And really, if that’s all, there’s an easier route. Btw, eventually this was all for a Unity application to respond to chat messages as commands, so this tutorial video may be of use to many who find this issue.

It is straightforward, “let’s read irc chat from a Twitch channel”, and it authenticates in a likewise straightforward manner: just go to a site while logged in to request and grant access to receive an OAuth token to use with this simple C# client connection system. (no plugins needed)

Simpler is better.

The web endpoint to get such authentication is available from the video description.

'Hope that helps

It’s strongly discouraged to use 3rd party token generators. Not only will the tokens be invalidated if anything was to happen to the app, but also that uses the Implicit OAuth flow so there’s no possible way to refresh the token. So there are both security and technical implications for using other peoples token generators.

Legacy apps, such as the one used by that tool, don’t currently expire, as the app was made prior to tokens expiring, but when that gets changed and they do expire that could also kill your tokens with no possibility of refreshing as the Implicit flow doesn’t have a refresh token.

For getting an OAuth token in Unity, the recommend way would be to use the Device Code Flow (DCF). This is what the Twitch Game Engine Plugin uses too, and it allows your app to get an OAuth token without needing to run a web server, it can be refreshed when it expires, doesn’t have the same issues that your ‘solution’ has, and doesn’t need a Client Secret, so for client-side apps like Unity it can be distributed in apps without needing to expose any credentials that should be kept secret.

The cli is more a test tool

As when the token dies you need a new one

So as dist suggests you need to implement an oAuth flow. Not use a test tool

(SOLUTION x2) Thank you for helping. In that case, there is a fine Unity example to gain OAuth tokens with simple namespaces natively available. And, this was easy enough to modify for my purposes, effectively passing the token to the chat connection script linked above once it is received. While the above tutorial and 3rd party app use was helpful to initially develop, this route appears to be the recommended safer route you all mentioned in reply. Again, thank you for helping. GitHub - TheHellcat/Unity-Twitch-OAuth-Example: A quick example how to do Twitch OAuth using a temp. local "webserver" directly in a Unity project.

For unity you probably want DCF Getting OAuth Access Tokens | Twitch Developers

This tutorial/repo predates DCF existing as an option