Code:
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');
}
What happens is that my URL becomes "http://127.0.0.1/thebot/oauth#access_token={AccessToken}&scope=". Somehow the "?" gets replaced with "#". Does anyone see an error in my code or know a workaround so I can like switch it out or something?