How to get my Moderator Id?

No you need a USER token which is what the rror is saying

oAuth expects a server to be running as your redirect URI (which is defaulted to localhost if you never change it)

The basics of user oAuth is

  • User visits your website
  • User clicks the link to take them to Twitch
  • User accepts (or declines) the link
  • If they accept they are redirected to your redirect URI with a ?code
  • Your server exchanges the ?code= for an access and refresh token

Then you can adapt the oAuth process to run headless.

  • Start the app
  • App provides a link for the user to copy/paste into a browser
  • User is taken to Twitch
  • User accepts (or declines) the link
  • If they accept they are redirected to your redirect URI with a ?code
  • User copy and pastes the ?code into your app and the app does the exchange

This is a NodeJS example for “headless” oAuth https://github.com/BarryCarlyon/twitch_misc/tree/main/authentication/user_access_without_server

Then you need to figure out a way to obtain a user token to provide the user token to your application so it can operate