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

How to pass the OAuth signature in a GET request

ANSWERED

I'am developing in Woklight an HTTP adapter (using javaScript) to retrieve data from fitbit.

Any idea how to pass the OAuth signature in a GET request parameters via "Authorization" HTTP header??

I receive following error:

"message": "No Authorization header provided in the request. Each call to Fitbit API should be OAuth signed"

 

 

Here is my adapter JavaScript GET request procedure:

 

var pathActivities = '1/user/-/activities/date/2014-07-01';

function getFitbitActivities(pathActivities) {

  path = getPathElement(pathActivities);

 

 var input = {

   method : 'get',

    returnedContentType : 'json',

    path : path,

 

   oauth_consumer_key :'b54a8e0fe4314969b52505768c5f1d08',

   oauth_signature_method :'HMAC-SHA1',

   oauth_timestamp : '1404691128',

   oauth_nonce :'389925176',

   oauth_version : '1.0',

   oauth_token : 'c22c1aa3979578cd22502527a5e28321',

   oauth_signature : '5IrAUFEBZIA3LwhjKT4gETGvF5k%3D'

  };

 

  

return WL.Server.invokeHttp(input);

}

 

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

You can specify any callback url you want.

As long as you have [Application Type] set to desktop, callback url won't be used, although it is required all the times indeed.

Ivan Bahdanau
Senior Software Developer at Fitbit

View best answer in original post

Best Answer
10 REPLIES 10

Fitbit currently supports passing parameters via Authorization header only.

Please see 5.4.1 here: http://oauth.net/core/1.0a/#auth_header .

Instead of setting several oauth header parameters you only need to set one "Authorization" and put all oauth parameters comma-separated.

 

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

Thanks for the documentation but still not clear:

- Do I need to specifically import the OAuth Core 1.0 Lib? or is part of any standard or Java libs?

- Do you have a coding example, preferable in JavaScript, how to build the Authorization header?

- Also is there any java/javaScript API how to get the Tokens, i.e. oauth_consumer_key, oauth_signature_method, oauth_nonce, oauth_version,  oauth_token, oauth_signature ???

In the page that you indicated (http://oauth.net/core/1.0a/#anchor45) I see only URLs examples.

 

Best Answer
0 Votes

Hello.

There is java oauth 1.0 library that you need to specifically import. 

The source code for this library is here: http://oauth.googlecode.com/svn/code/java/. If you want to use this library you'll need find, download and to import oauth.jar and oauth-provider.jar.

 

Related to javascript library you canuse any of libraries from here: http://oauth.net/code/

check out javascript section for js libraries. Ddo library in this secrion work great.

Also check out https://dev.fitbit.com/apps/oauthtutorialpage that will provide 

 

Related to you question " is there any java/javaScript API how to get the Tokens, i.e. oauth_consumer_key, oauth_signature_method, oauth_nonce, oauth_version,  oauth_token, oauth_signature ???" please refer to this documentation: https://wiki.fitbit.com/display/API/OAuth+Authentication+in+the+Fitbit+API 

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

Thanks for info. When a try to register my mobile application with fitbit, in order to obtain the <consumer key>  and < consumer secret>, the form requires mandatory to enter my application web site, which I can not provide, since a mobile app does not have a hosting URL. Please advise what should I do?

Best Answer

You can specify the url for your application in apple store or play store.

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

I do not have yet an URL in apple store or play store, since right now is an internal demo application.

Do you have any suggestions? Thanks!

Best Answer
0 Votes

Feel free to put a placeholder URL in the mean time

Best Answer
0 Votes

Thanks for that valuable question, i faced the same issue sofar, by seeing your post i could able to clarify myself, and also it asking "callback" url, im not aware of callback url while registering my app, im trying to regiser a app for ios, so could you please help me ! 

Thanks

Best Answer
0 Votes

You can specify any callback url you want.

As long as you have [Application Type] set to desktop, callback url won't be used, although it is required all the times indeed.

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer

Thanks a lot ibahdanau !

 

 

Best Answer
0 Votes