Have you registered your application on twitch? You will need to do this in order to get an client-ID.
I did the following a while back when developing a app for twitch:
-
When loading the authorization page you need to send the user to something like the following url:
https://api.twitch.tv/kraken/oauth2/authorize?response_type=token&client_id=YourClientIDHere&redirect_uri=YourRedirectURIHere&scope=openid -
The above will load the login page, once the user signs in they will be redirected to the redirect_uri that you passed in your request.
-
You should then get an error back, or a valid response with access_token in the url. You can then use this within the application for the current user.
Hope this helps 