Hey everyone!
I’m trying to create a follower button on the website i’m developing. However i’m a UI developer and at UX i mostly get stuck as i am now. The idea is to login to the site using twitch (Which works perfectly) and then add a button to the page to follow a specific user.
When i click the button at this moment i get redirected to my redirect_uri but without following the actual channel.
However i’m stuck at how to get the token perfectly. The code you see is what i have at the moment, but as i said it’s not my strongpoint.
function follow(){
POST https://api.twitch.tv/kraken/oauth2/token
&client_id=INSERT
&client_secret=INSERT
&grant_type=INSERT
&redirect_uri=http://twitchstreams.org/testpage.php
&code=$_GET['code']
curl -H 'Accept: application/vnd.twitchtv.v3+json' -H 'Authorization: OAuth '.$code \
-X PUT https://api.twitch.tv/kraken/users/GETUSERNAME/follows/channels/masterwolfeh
}
Where i wrote INSERT, i have those data just not having it public.
GETUSERNAME is where i don’t see how i can get the name in there of the connected user.
HTML
<button onclick="follow">test</button>
Is anyone able to help here?
With kind regards,
Celeste