400 - Parameters are messed up again? Refreshing Token

When I send an POST request to the API, I receive an 400 error, but no more info like what is wrong.

The code:
Twitch::Post("https://api.twitch.tv/kraken/oauth2/token", array( "grant_type" => "refresh_token", "refresh_token" => Aresak::mysqli_result($result, $i, "extras"), "client_id" => Twitch::ClientID(), "client_secret" => Twitch::ClientSecret() ));

I guess there are messed up parameters again. Like client_id should be Client-ID etc., but I don’t know which are right as far as there is nothing in the documentation.

Post request in Php

Do you log the request you make so you know your code is requesting the URL with the data in the format you’re expecting?

Yes, I know it is correct.

Did you ever figure this out? I am getting “message”: “The parameter “grant_type” was malformed: value must be one of “authorization_code”, “password””. Is using the Refresh_Token not supported? Then why make OAuth tokens invalid after 240 minutes?

Did you correctly follow the documentation:

To refresh, use this request:

curl -X POST https://api.twitch.tv/kraken/oauth2/token 
    &refresh_token=<your refresh token>
    &client_id=<your client ID>
    &client_secret=<your client secret>

Sounds like you have performed a GET request instead of a POST request

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