0

代码:

if (isset($_GET['access_token'])) {
$_SESSION['oauth'] = $_GET['access_token'];
$usernameResult = file_get_contents("https://api.twitch.tv/kraken?oauth_token=" . $_SESSION['oauth']);
$json_decoded_usernameResult = json_decode($usernameResult, true);
echo $_SESSION['username'] = $json_decoded_usernameResult['token']['user_name'];
} else {
header('Location: https://api.twitch.tv/kraken/oauth2/authorize?response_type=token&client_id={clientID}&redirect_uri=http://127.0.0.1/thebot/oauth');
}

发生的情况是我的 URL 变为“ http://127.0.0.1/thebot/oauth#access_token= {AccessToken}&scope="。不知何故“?” 替换为“#”。是否有人在我的代码中看到错误或知道解决方法,以便我可以将其切换或其他什么?

4

1 回答 1

0

看起来您正在等待授权代码流,但正在访问隐式授予流。我建议看看这里的差异。

于 2015-02-20T00:52:53.240 回答