redirect_mismatch (again)

Sorry, i dig all what i have found here and on google but can’t fix my bug.

This is the URI registered for my application on my twitch account:

this is my connection string[mycode]&redirect_uri=

the URI are exactly the same, as you can see and as i copypasted it into the account, but what i get is:

[page] => account
[action] => twitch_connect
[error] => redirect_mismatch
[error_description] => Parameter redirect_uri does not match registered URI

could anybody kindly help?

After a quick looks it appears you are not escaping the redirect url before the redirect back to Twitch (mainly the query string).

This should work:[mycode]&
1 Like

Make sure to url encode the redirect_uri. becomes, so the final url will be[mycode]&


it works :slight_smile:
then there are so many tricks, but i past my code where i authenticate, then rethreive the token, then load user data.
The kink:

		<p><a href="" class="btn btn-slide-panel btn-lg btn-block" >link</a></p>

The code to get linkback parameters (php)

$url = '';
$fields = array(
				'client_id' => urlencode('agagagagagagag4vak49ekqcg'),
				'client_secret' => urlencode('agagagagagagagagagiczy3g1kejq4zlwqt'),
				'grant_type' => urlencode('authorization_code'),
				'redirect_uri' => '',
				'code' => urlencode($_REQUEST['code'])
$fields_string ="";
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
$array = get_object_vars(json_decode($result));
$access_token = $array['access_token'];
$scope = "user_read";

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, "");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$headers = array();
$headers[] = "Accept: application/vnd.twitchtv.v3+json";
$headers[] = "Authorization: OAuth ".$access_token."";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$content = curl_exec($ch);
$array = get_object_vars(json_decode($content));
	} else {

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