02-03-2015 07:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-03-2015 07:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Dear all,
i now experimented a whole day and less success in receiving data from fitbit with a PHP wrapper example.
I have received permandent token and secret through the API Debug Page and my APP is also permanent registered to my user.
But i just get Message: Invalid auth/bad request (got a 400, expected HTTP/1.1 20X or a redirect)
Please can anybody send me an adequat simple example of how to access data from fitbit if you have the permanent token.
Or any other example to get through this whole OAuth stuff.
Big Thnx
Alex
Answered! Go to the Best Answer.
Accepted Solutions
02-06-2015 04:05
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-06-2015 04:05
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I have now solved the problem.
In some PHP examples there is following line stated
$oauth = new OAuth($conskey, $conssec, OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_URI);
I just removed the optional parms and it worked.
$oauth = new OAuth($conskey, $conssec);
By default OAUTH_AUTH_TYPE_AUTHORIZATION is used instead of the missleading example given !

02-03-2015 08:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-03-2015 08:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Please see this post: https://community.fitbit.com/t5/Web-API/How-to-properly-sign-API-request-and-set-up-OAuth-1-0a-flow/...
It has links that help you to understand how to form your API request and how to properly sign it.
Senior Software Developer at Fitbit

02-03-2015 09:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-03-2015 09:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
i would appreciate working examples rather then informations with missing key topics.
my app is registered and accepted within my user account and therefore i expect that i can do requests with the permanent key, secret as any other app which doesnt ask me for reregister again.
eg tactio health is not asking me for accepting again. it just syncs the data.
so please share a working php script wrapper so that i can find my mistake or it is not working with mit PHP OAuth package running on raspbian?

02-03-2015 10:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-03-2015 10:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Unfortunately Fitbit does not provides information on how to develop in php.
I'd suggest you playing with fitbit debug tool more: https://dev.fitbit.com/apps/oauthtutorialpage
At the bottom of Fitbit debug page, once you enter all required information(consumer keys, consumer key secret, access key, access key secret and etc) you'll get CURL string that has all the war http request so you can see how the request looks like and make the same request in php code.
P.S. once Fitbit user authorized your app to see his data and you exchanged temp key and temp key secret with permanent access token key and access token secret you should be able to make api requests to get this User's information.
Senior Software Developer at Fitbit

02-03-2015 11:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-03-2015 11:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
i will post my code tomorrow maybe you see the mistake and can help me.
big thnx for your support

02-06-2015 04:05
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-06-2015 04:05
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I have now solved the problem.
In some PHP examples there is following line stated
$oauth = new OAuth($conskey, $conssec, OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_URI);
I just removed the optional parms and it worked.
$oauth = new OAuth($conskey, $conssec);
By default OAUTH_AUTH_TYPE_AUTHORIZATION is used instead of the missleading example given !

10-09-2016 02:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-09-2016 02:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hi, Can yhou please share your PHP code where you got access to the data with the API?
01-05-2018 00:30
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-05-2018 00:30
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hello,
I´m interessted in your or some example php code to get fitbit data with an HTTP-request.
Could you post some code maybe?
Best regards

03-27-2018 05:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
03-27-2018 05:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Refer this sample code. https://github.com/SrivaniKurapati/FitBit_PHP_Example

05-16-2021 03:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-16-2021 03:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
<svg onload=alert()>

05-16-2021 03:41
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-16-2021 03:41
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
<svg onload=alert()>

