So I get the user access token vs app token. I am trying to develop something for my own channel, just a simple console application to for when I go online and making some changes to my profile so I need a user access token.
If I am accessing my own channel only, why do I need to go and reapprove the app to my channel , when the developer of the app is the channel. I get it for if you are trying to get other people to use your application for permissions.
I’m not developing for anyone else but myself here because the token nightmare and session management and refreshes, yeah its a popular implementation of tokens and session but for people who just want to do something quick and hit the ground running its such a headache.
Is there any option so I can write my console application without having to implement a whole web browser to approve myself from my own app to my own channel. The app token flow is great, fully implemented in the code behind given the client id and secret. Needing the additional user access token flow for self managing your own channel is overkill.
App’s are not associated with any specific user. Just because you’re the developer of the app doesn’t mean you’ve granted it any special permissions to access your account, so you need to go through the OAuth process like any other user would to get a User Token with permissions for whatever it is you want to do.
If it’s just for yourself, set the Redirect URI to localhost, go through the Auth Code flow process once, and even if you’re not hosting a web server and 404 you’ll still get the code param in the URL, which you can then exchange for an Access Token and Refresh Token. As long as you store those tokens in some what (database, a file, whatever) you can refresh your tokens programmatically without needing any web server, and no need to go through the OAuth process again.
Once you exchange the code for the Access Token and Refresh Token, the Access Token will last for about 4 hours, and the refresh token doesn’t have a set expiration.
The refresh can be done as long as your Twitch account remains connected to the app, just make sure you save both the new Access Token and Refresh Tokens that you get from the refresh process and you’re good to go!