I am using the official method from : Authentication | Twitch Developers
to retrieve the authenticate token for a chat bot but it seems the authenticate token the server is creating is not working as it should .
i tested the authenticated token in official example i took from github : https://github.com/TwitchDev/chat-samples/tree/master/python
i don’t want allow any 3rd party to access my account as i found in these forums suggested many times and i want to create a authenticated token that is working and valid for my chat bot .
the main reason that i don’t want allow any 3rd party site access my account is that i had very bad experience from twitter and Facebook where the client sends malicious links to the contacts of a user and without his approval of course .
for the reference the python code i am using to generate the authenticated token is this :
r = requests.post(“https://api.twitch.tv/kraken/oauth2/token?client_id=[client-id]&client_secret=[client-secret]&grant_type=client_credentials”)
server_responce = r.json()
with open(“server_responce.txt”, “w”) as file:
with open(“auth_token.txt”, “w”) as filex:
also the registration page in dev apps site reports that the chat application app is working as you can see in the image … https://i.imgur.com/SDepcRd.jpg
So , what is the reason the chat bot is not connected from my local server and stacked in this message ?
Connecting to irc.chat.twitch.tv on port 6667…
Is there any network ports i need to open locally and forward to work as it should be or the bot doesn’t need to act like a server like i am doing in twitter and google ?
You are generating an app access token with the client credentials flow so that’s why it is not working. You need a user access token. Use either OAuth Implicit Code Flow or OAuth Authorization Code Flow (or the OIDC variants).
Keep in mind since this is a user access token the user whose account will be connecting to chat needs to accept the request via their browser. It cannot be done completely server-side.
thank you for the reply.
i looked again the differences between all these authentication modes and i realized that i can not create str8 the auth token since every method of these return to url that need to redirected by a web server …
i am creating now a django local server to handle the redirection but as i said in my main post for me the usage of a 3rd site for authentication token is a backdoor to my account , since i will authorize a site to view and most important manage my account
so for me now there is only one way … find a way to create locally the authentication token or leave the twitch platform
as @george said
Is what you need here. This requires no web access able server.
Which is what the TMI Code generator does Twitch Chat Password Generator it uses implicit auth
thank you Barry but …
both 1) and 2) ways in OAuth Implicit Code Flow (User Access Tokens) return the whole HTML login page of twitch.tv with GET request and not an authentication token and if i open it with browser the CAPTCHA fails “Cannot contact reCAPTCHA. Check your connection and try again” .
is there any value inside this HTML page that is the authenticate token ?
You must run thru an authentication loop…
The user must be guided to the Twitch login page in order to authorise the connection.
If you are literally just need a chat_login scoped key for your bot to login. Just use the Token returned by https://twitchapps.com/tmi/ i
so barry , there is not a simple way without a web server to create an authentication token in twitch because this authentication loop is actually a web server
Well you could use implicit auth with a static HTML/JS file that you just open using the file:// syntax in a web browser.
But once you get the oAuth key you won’t need to generate again unless you deauth the app
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.