Step G tests the API request and works fine for me. But I can’t for the life of me figure out how to generate the “Signature” for step G.
I asked in the fitbit forums but they pointed me to scribe-java or oauth-signpost libraries and I still can’t figure out how these translate to ST groovy device code.
I found some posts from @geko about OAuth but it seems to be a less complicated implementation. Fitbit has a very complicated handshake.
I did manage to get OAuth working for my enlighten Solar System so I know I can work with the simpler implementation but fitbit is very secure.
Any tips on translating this into Groovy Code ? I am new to Groovy so not too sure what I need to do. I found the fitbit docs but they don’t have much in the way of sample code.
Is there a groovy library that I can use to generate this signature ?
So I dropped the code into my driver along with an import of
import oauth.signpost.*;
but I get the following when I try to save
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
script14256159878791956698891.groovy: 83: unable to resolve class OAuthConsumer
@ line 83, column 20.
OAuthConsumer consumer = new DefaultOAuthConsumer(
^
script14256159878791956698891.groovy: 83: unable to resolve class DefaultOAuthConsumer
@ line 83, column 31.
OAuthConsumer consumer = new DefaultOAuthConsumer(
^
script14256159878791956698891.groovy: 89: unable to resolve class OAuthProvider
@ line 89, column 23.
OAuthProvider provider = new DefaultOAuthProvider(
^
script14256159878791956698891.groovy: 89: unable to resolve class DefaultOAuthProvider
@ line 89, column 34.
OAuthProvider provider = new DefaultOAuthProvider(
^
4 errors
But These should have been defined from the import.
I am starting to think the ST can’t support OAuth 1.0. I have tried to import the libraries I need but can’t seem to figure out how to do an import. Using @Grab doesn’t work and straight imports don’t seem to work. Feel like I am working in the dark here too many much is new to me so I don’t know what is me doing things wrong and what is limited by the ide.
Digging a little further I have learned that ST supports OAuth 2 not OAuth 1.0 and libraries can not be imported. So looks like for now I need to wait for Fitbit to upgrade to OAuth 2 or try to write some type of relay service or something…I think I will wait.
@isriam if I get a device working I will post it back to the community. What would you want to be using it for ? Just so I have an idea of what the device should support.
I was planning on having it report my weight so I could have ST nag me if i start gaining
Given that OAuth sits on top of HTTP, I would imagine that this wouldn’t be hard to implement; even if to hack.
Is the source code saved anywhere where I could have a look? I had to teach myself how to make Lockitron OAuth work, so since that is still a little fresh-ish in my head I’d love to look.
Well, most browsers have developer tools typical f12 to access. They usually have a network tab that logs the requests and responses between the server and browser.
From those interactions one can reverse the browser interaction with user and server and then recreate it in a smart app using the httpget/post/put functions and getting the responses and session and cookies to get at whatever data the browser presents.
My first recommendation is to split the OAuth code out of the Device Type. The general practice is the OAuth/authentication code is built into a Smart App called a Connect app. It basically handles the cloud-to-cloud access, and then a child Device Type represents the individual devices (so, in this case, the trackers and scales and whatnot). Check out my Lockitron code for an idea: https://github.com/dkirker/smartthings-lockitron
Hi all. I just gave up on waiting for the UP3 to ever be released and purchased a FitBit Charge HR. I’d love to help with SmartThings integration if no one here has had any luck yet. Let me know what the current status is and I’ll see what I can do.
I am waiting for FitBit to release their OAuth 2.0 public beta access. OAuth 1 doesn’t work with ST. It has been mentioned in this thread that you can probably write an external interface to the OAuth 1 that ST could access but OAuth 2.0 will be much easier to maintain.