It does not work the way you are trying to do it since OAuth requires a browser to authorize the application. You need to redirect the user to Twitch to authorize and then Twitch will redirect back to your web application to provide the OAuth token or code.