04-27-2015 17:09
04-27-2015 17:09
I have registered my application online like the following:
For Application Website and Organization Website parts, I use the current IP address of the local PC, because I want to run the local Apache Server for testing purpose. Then I download FibitPHP.php for configuration and put it to the htdocs of Apache server. After that, I write down the following php scripts and acquire FitbitPHP.php script as following:
As you can see, I have tried three ways to get the profile of the user(initSession, setUser, setOAuthDetails), but none of them work. I echo the HTTP response but print nothing on the screen, which might suggest there is no match between the token and the account in your database.
Could anyone please help me figure out why this situation has happened?
04-28-2015 09:34 - edited 04-28-2015 09:35
04-28-2015 09:34 - edited 04-28-2015 09:35
You need to go through the authentication flow to get a user's token to access their data. It looks like you got that code from the README.md for the fitbitphp project, you should check the snippets above that and specifically the part with:
$fitbit->initSession('http://example.com/callback.php');
or for subsequent calls where you have already obtained the token
$fitbit->setOAuthDetails('token_stored_for_user', 'secret_stored_for_user');
04-30-2015 09:33
04-30-2015 09:33
Thanks for yor help. But I have checked my inisession function and remain functions and I thought I have configured it all right according to the instructions. But it still does not work all the time...