09-02-2014 04:29
09-02-2014 04:29
I am using Fitbit4J api in a J2EE application deployed on Tomcat 7. I have successfully completed OAuth based flow and got the temp token and vefifier after completion of OAuth flow. Next I store that information iin database and later I want to use this information to refresh the user data (number of steps) in my app.
But I am stuck at this exception
Please tell me how to correctly configure APIResourceCredentials object for calling getActivities, for an authenticated user. I can see it has a contructor asking for three parameters where the last one being the tempSecret. How do I get that ? Will it be same for all the a requests ? Please share if you can think about any other cause of this error ?
09-02-2014 07:53 - edited 09-02-2014 07:53
09-02-2014 07:53 - edited 09-02-2014 07:53
The exception you're getting is correct.
You can not use temp credentials to make API requests you need temp credentials so you can exchange them for permanent access tokena and secret.
Please eplore fitbit oauth debug tool here to better understand the oauth 1.0a flow: https://dev.fitbit.com/apps/oauthtutorialpage
09-03-2014 04:44 - edited 09-03-2014 04:46
09-03-2014 04:44 - edited 09-03-2014 04:46
Thanks Ivan,
Sorry but I really couldn't understand the given link. I have solved the above problem the error was in creating Fitbit user creation which I was doing with localuserId instead of resource id of the resource credentials. That said I have two questions and I know you are the best person to ask them, please help:-
Thanks Buddy,
I have really tried to answer this questions on my own but couldn't find a solution. Please help!
09-03-2014 08:03 - edited 09-03-2014 08:04
09-03-2014 08:03 - edited 09-03-2014 08:04
Answers to both of you questions are at the link that I gave you above: https://dev.fitbit.com/apps/oauthtutorialpage please read it precisely and try to make every step in this debug tool. Based on what you provided you're currently at steps 5-7. You need to do steps 8-10.
Also please read https://wiki.fitbit.com/display/API/OAuth+Authentication+in+the+Fitbit+API#OAuthAuthenticationintheF...
it has very good description of oauth 1.0a flow which answers both of your questions.