Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PHP Example for Fitbit Access and requesting Data

Most of the time Fitbit login works just fine on our site. It has been in production for a year so no major concerns except occasionaly we get the below error messages.

 

Are these cause for concern?

 

'''

[25-Feb-2015 22:46:49 UTC] PHP Fatal error:  Uncaught exception 'OAuthException' with message 'Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect)' in /home/sprout/public_html/sprout/application/libraries/Sprout_fitbit.php:88

Stack trace:

#0 /home/sprout/public_html/sprout/application/libraries/Sprout_fitbit.php(88): OAuth->getAccessToken('https://api.fit...', '1', 'sarlu8iqf91fe04...')

#1 /home/sprout/public_html/sprout/application/controllers/external_services.php(239): Sprout_fitbit->initSession('https://mckinse...')

#2 [internal function]: External_Services->fitbit_login()

#3 /home/sprout/public_html/sprout/application/core/MY_Controller.php(245): call_user_func_array(Array, Array)

#4 /home/sprout/public_html/sprout/codeigniter/system_2_0_2/core/CodeIgniter.php(305): MY_Controller->_remap('fitbit_login', Array)

#5 /home/sprout/public_html/sprout/index.php(226): require_once('/home/sprout/pu...')

#6 {main}

  thrown in /home/sprout/public_html/sprout/application/libraries/Sprout_fitbit.php on line 88

```

Best Answer
0 Votes
3 REPLIES 3

We can't debug your application code. Can you please provide the HTTP request and response?

 

Specifically, knowing the body response from the 401 would likely detail the issue.

Best Answer
0 Votes

Hi and thanks very much for your fast response. 

 

I have been using https://github.com/heyitspavel/fitbitphp so I wondered if it is a common issue.

 

I have made a change to the code which will store the response if there is an exception.

 

Currently I am waiting for this to go into production, once I have some useful responses I will get back to you.

 

thankyou

 

 

Best Answer
0 Votes

Hey I am getting the same error how did you resolve this. 

Best Answer
0 Votes