401 Client Error: Unauthorized for url

Either use the Implicit auth flow: https://dev.twitch.tv/docs/authentication/getting-tokens-oauth#oauth-implicit-code-flow which once expires you’ll have to go through the process again.

Or use the Auth Code flow: https://dev.twitch.tv/docs/authentication/getting-tokens-oauth#oauth-authorization-code-flow which will give you a refresh token too so you can generate new tokens as needed.

The reason App tokens can’t work is because they’re not associated with any user, so they have no special permissions attached to them. You need to actually send a user through the Auth flow so that they explicitly grant the app permission to access the scopes you’ve asked for.