|
|
 Peiere - 2014-03-06 12:19:27
Hi There
I have had a play around with login_with_fitbit.php + http.php + oauth_client.php scripts, and its the only API for fitbit I can get working.
However, every time I use the "login_with_fitbit" it prompts me to login.
is there a way I can extract a users data without them having to login beforehand?
I want to post my daily step total for the day on my website.
and with the current solution, people will be prompted for a fitbit login when connecting to my site.
Is there a way to use this script to pull publicly visible data without triggering a login screen?
 Manuel Lemos - 2014-03-06 12:51:47 - In reply to message 1 from Peiere
By default, the base class uses sessions to store tokens. But sessions are only valid when the real user accesses with the browser.
You need to store the access token in some other persistent container, like a database, to be able to use the token when the user is not present. There is a sub-class for storing and retrieving tokens in a database.
Read this article. It is about Google but you can adapt it for Fitbit too.
phpclasses.org/blog/package/7700/po ...
 Peiere - 2014-03-11 07:56:06 - In reply to message 2 from Manuel Lemos
Thanks for the response!
I was hoping I could hardcore my own login details into the authorization token process so users weren't prompted with login screen, as I only ever want to query my own daily step total for my website, but it seems like Ive chosen a too complex solution.
 Manuel Lemos - 2014-03-11 08:40:58 - In reply to message 3 from Peiere
If only want to access your account details via Facebook API, you can cache a previously obtained token after you authorize your site to access Facebook API on your behalf.
Now, if you want to access other Facebook users details using your own authorized token, you cannot do that. If Facebook allowed that, it would be a privacy violation.
What you can do is access part of other users that may be your friends.
 Peiere - 2014-03-11 08:47:16 - In reply to message 4 from Manuel Lemos
Nah, My problem is with Fitbit Oauth,
I want to use my API key, to pull my profile details.
Eg. Piere has walked 8000 steps today
It never needs to look at toher peopls data
hence why I think this code might be a bit complex for me
 Manuel Lemos - 2014-03-11 09:22:16 - In reply to message 5 from Peiere
It is the same for all OAuth based APIs. When I mentioned Facebook was to make clear that you cannot use the authorization of your application to access the details of one user to access the details of another user.
If you just want to access the details of your own user, you can use the OAuth token obtained when you authorized your application to access it.
The Fitbit API requires that you go through the OAuth process. This means that at least once you need to let the OAuth process go through redirection to the Fitbit site and get the token when it redirects back to your site.
wiki.fitbit.com/display/API/OAuth+A ...
 Peiere - 2014-03-24 01:55:29 - In reply to message 6 from Manuel Lemos
Just throught I'd Update my post,
Found a very dirty work around that didnt require me to install OAUTH on my server (which I couldnt do)
p337.x10host.com/?p=18
Thanks for your help tho!
 Manuel Lemos - 2014-03-24 10:33:20 - In reply to message 7 from Peiere
There is no reason you could not solve your problem with OAuth. But if you solved your problem with some other solution, that is OK too.
|