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

Oauth post parameter problems

Hi,

I have been using the API succesfully with oauth until I recently needed to POST parameters to http://api.fitbit.com/1/user/-/profile.json Currently I get a 401 error for an invalid signature.

 

The odd things is that if I remove the parameters from the body of my request it works, even if i leave them hashed in the oauth header!

 

Here is an example of a signature that i generate:

 

POST&http%3A%2F%2Fapi.fitbit.com%2F1%2Fuser%2F-%2Fprofile.json&height%3D192.1%26oauth_consumer_key%3D2df33d655bf54344a670344a994e4b84%26oauth_nonce%3D726n44e8kbuminqp60kjemkfqs%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1404148709%26oauth_token%3D4c449b762a17dbec7ce22d1feb9edccc%26oauth_version%3D1.0

 

Here is  what I use to add my parameters to the body(java):

 

String parameters = "height=192.1";

DataOutputStream wr = new DataOutputStream(conn.getOutputStream ());

wr.writeBytes(parameters);

wr.flush();

wr.close();

 

I assume that I am adding in the parameters incorrectly.

 

Thanks,

 

Liam

 

 

Best Answer
0 Votes
3 REPLIES 3

Are you using an existing OAuth client such as signpost, scribe, etc?

Best Answer
0 Votes

No I just wrote the code myself as it is fairly simply, and I haven't had any problems up to this point, I could add one of those libraries if i can't figure this out but I really don't want to Smiley Happy

Best Answer
0 Votes

We highly recommend using an existing client as OAuth 1.0 clients are more complicated than they appear. Using an existing client thats well tested will save you a lot of headache. (Theres also very good and easy to use clients for Java)

Best Answer
0 Votes