从昨天开始,我就忙于使用Twitch,使用重定向uri进行了简单的身份验证工作:
http://localhost:8000/redirect现在,我已经将重定向uri更改为:
http://localhost:8000/connect/twitch现在已经不起作用了。
我已经在the应用程序仪表板和请求中更改了uri,但是我仍然得到了"Redirect_Mismatch“。
我做错了什么?
抽搐模型:
class Twitch{
var $client;
var $oauth_token;
public function __construct($token = null)
{
$this->client = new GuzzleHttp\Client();
if($token != null) $this->setOAuthToken($token);
}
public function retrieveOAuthToken($code)
{
$res = $this->client->post('https://api.twitch.tv/kraken/oauth2/token', [
'body' => [
'client_id' => Config::get('twitch.client_id'),
'client_secret' => Config::get('twitch.client_secret'),
'grant_type' => 'authorization_code',
'redirect_uri' => Config::get('twitch.redirect_uri'),
'code' => $code
],
'verify' => false
]);
$result = json_decode($res->getBody());
$this->oauth_token = $result->access_token;
}
}文件:
return array(
'client_id' => 'REMOVED',
'client_secret' => 'REMOVED',
'redirect_uri' => 'http://localhost:8000/twitch',
);主计长:
class ConnectController extends \BaseController {
public function twitch()
{
$twitch = new Twitch();
$twitch->retrieveOAuthToken(Input::get('code'));
}
}Twitch设置:
抽动设置
发布于 2018-02-22 09:52:12
您需要更新您的laravel配置:
return array(
'client_id' => 'REMOVED',
'client_secret' => 'REMOVED',
'redirect_uri' => 'http://localhost:8000/connect/twitch',
);然后通过http://localhost:8000/connect/twitch调整重定向URI。
如果其中一个两个URL (Laravel或Twitch设置)与另一个不同,那么您将拥有Redirect_Mismatch
发布于 2015-03-09 16:32:39
您还需要在http://localhost:8000/twitch上初始化Twitch。我不确定Laravel等,但在本例中,尝试在该页面中添加Twitch,如果是这样初始化的话。
https://stackoverflow.com/questions/28323717
复制相似问题