I'm trying to pass the access_token that i'm recieving in the URL when I login but after authenticating and getting the access token, I am unable to call it via "$_GET". I'm also getting empty arrays anywhere(in the if statement, out of it at the end, in the beginning of the code).
<?php
define("client_id",'XXXXXX');
define("response_type",'token');
define("scope", 'activity heartrate weight');
define("expires_in", '86400');
echo $_GET;
print_r($_GET['access_token']);
var_dump($_GET);
if($_GET['access_token']){
echo 'success';
} else {
?>
<!DOCTYPE html>
<html>
<head>
<title>FITBIT API</title>
</head>
<body>
<a href="https://www.fitbit.com/oauth2/authorize?response_type=<?php echo response_type; ?>&client_id=<?php echo client_id; ?>&scope=<?php echo scope; ?>&expires_in=<?php echo expires_in; ?>">LOGIN INTO FITBIT</a>
</body>
</html>
<?php
}
?>
Fitbit responds back with this link in the URL after I login into Fitbit which leaves me confused, I see the access_token there but $_GET wont "GET IT":
http://www.xxx.xxx/fitbit.php?#scope=weight+heartrate+activity&user_id=23942H&token_type=Bearer&expires_in=74915&access_token=eyJhbGciOizIUzI1NiJ9.eyJleHAiOjE0NDc3MzYzOTAsInNjb3BlcyI6InJ3ZWkgcmhyIHJhY3QiLzJzdzIiOiIyMzk0MkgiLCJhdWQiOiIyMjlTzloiLCJpc3MiOiJGaXRiaXQiLCJ0eXAiOiJhY2Nlc3NfdG9rZW4iLCJpYXQiOjE0NDc2NzE0NzV9.YDy6fiyZ7iZ6wKJ2tYTI_NV8MHL5k4ymLcRGHmoPO0k
After a while of researching I found out that the # in the URL being received was interfering with the data being parsed. I switched it from define("response_type",'token'); to define("response_type",'code');. This enabled me to receive an authorization code instead which I can use for a access_token to get the data needed.