Why i cant refresh my access token? "page not found"

Hi, i am trying tor efresh my token with this curl line

https://id.twitch.tv/oauth2/token--data-urlencode?grant_type=refresh_token&refresh_token=dpymoduqsgqx72qsjpdjigmdnj438zaci1jfmjf0qxsm0f1udb
&client_id=ea5edl3aletwqktirdeva92z47ge4m&client_secret=“censored”

i get this error when execute “404 page not found”
this is the link from the api not sure why not working, any help?

You’re getting a 404 because --data-urlencode isn’t part of the URL, it is part of the curl command in the example docs, so you’re sending a request to the wrong URL. Try removing --data-urlencode and it should work.

tyy!!! i get confused because in the api the data-urlencode appear likke part of the request!!!

after i get the response i cant decode from json not sure why, i am using php but on the print of array only show “int(1)”

$ch2 = curl_init("https://id.twitch.tv/oauth2/token?grant_type=refresh_token&refresh_token=".$arrayToString."&client_id=ea5edl3aletwqktirdeva92z47ge4m&client_secret=");

// setopt

curl_setopt($ch2, CURLOPT_CUSTOMREQUEST, "POST");

curl_setopt($ch2, CURLOPT_HTTPHEADER, array(

'Accept: application/vnd.twitchtv.v3+json'

));

$json2 = json_decode(curl_exec($ch2), true);




var_dump($json2);

I’m not a PHP guy so I can’t offer much help, I’ll leave it to others with more PHP experience to offer advice.

All I can see from a brief glance is that I don’t understand why you’re setting the Accept: application/vnd.twitchtv.v3+json header. that’s not needed. The Refresh Access Token docs don’t require setting any additional headers, just the specified querystring params.

ye i know i added because without i had the same result, ty anyway.
fixed the curl session wasnt closing in the loop!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.