If you are going to use the code response_type=code, on your server, you have make the following request to obtain an access token:
POST https://api.twitch.tv/kraken/oauth2/token
`POST Body (URL-encoded)
client_id=[your client ID]
&client_secret=[your client secret]
&grant_type=authorization_code
&redirect_uri=[your registered redirect URI]
&code=[code received from redirect URI]
&state=[your provided unique token]
The server will respond with a JSON-encoded access token:
{
"access_token": "[user access token]",
"scope":[array of requested scopes]
}
Then use that access_token that was returned.
or
you can use response_type=token and the access_token will be returned as part of the redirect_url.
- Make sure you are using the
access_tokenas theOAUTH_TOKENand not thecode.