Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fitbit-js

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fitbit-js - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

6

example/test.js

@@ -7,6 +7,6 @@ var express = require('express');

var PORT = process.argv[4] || 8553;
var PORT = process.argv[5] || 8553;
var fitbitClient = require('../')(process.argv[2], process.argv[3],
'http://localhost:' + PORT);
'http://localhost:' + PORT, process.argv[4]);

@@ -25,3 +25,3 @@ var token;

app.get('/getStuff', function (req, res) {
fitbitClient.apiCall('GET', '/user/-/activities/date/2011-05-25.json',
fitbitClient.apiCall('GET', '/user/-/profile.json',
{token: {oauth_token_secret: token.oauth_token_secret,

@@ -28,0 +28,0 @@ oauth_token: token.oauth_token}},

@@ -13,15 +13,16 @@ /*

var baseURI = 'http://api.fitbit.com/1';
var baseURI = 'https://api.fitbit.com/1';
module.exports = function (api_key, api_secret, callbackURI) {
var client = {version: '0.1.0'};
module.exports = function (api_key, api_secret, callbackURI, unit_system) {
var client = {version: '0.2.1'};
var serializer = Serializer.createSecureSerializer(api_key, api_secret);
var headers = {'Accept': '*/*', 'Connection': 'close', 'User-Agent': 'fitbit-js ' + client.version};
var oAuth = new OAuth('http://api.fitbit.com/oauth/request_token',
'http://api.fitbit.com/oauth/access_token',
if (typeof unit_system !== 'undefined' && unit_system !== null) headers['Accept-Language'] = unit_system;
var oAuth = new OAuth('https://api.fitbit.com/oauth/request_token',
'https://api.fitbit.com/oauth/access_token',
api_key, api_secret, '1.0', callbackURI,
'HMAC-SHA1', null,
{'Accept': '*/*', 'Connection': 'close', 'User-Agent': 'fitbit-js ' + client.version});
'HMAC-SHA1', null, headers);
function requestCallback(callback) {

@@ -47,2 +48,6 @@ return function (err, data, response) {

}
function oAuthDelete(path, params, token, callback){
oAuth.delete(baseURI + path, token.oauth_token, token.oauth_token_secret, requestCallback(callback));
}

@@ -55,3 +60,4 @@ // PUBLIC

else if (method === 'POST') post(path, params, token, callback);
}
else if (method === 'DELETE') oAuthDelete(path, params, token, callback);
};

@@ -61,3 +67,3 @@ client.getAccessToken = function (req, res, callback) {

if(req.cookies && req.cookies.fitbit_client) {
try { sess = serializer.parse(req.cookies.fitbit_client) }catch(E){ }
try { sess = serializer.parse(req.cookies.fitbit_client); }catch(E){ }
}

@@ -84,3 +90,3 @@ var qs = url.parse(req.url, true).query;

{ path: '/', httpOnly: false }); // stash the secret
res.redirect('http://www.fitbit.com/oauth/authorize?oauth_token=' + oauth_token);
res.redirect('https://www.fitbit.com/oauth/authorize?oauth_token=' + oauth_token);
});

@@ -87,0 +93,0 @@ }

{
"name": "fitbit-js",
"description": "Simple FitBit API client",
"version": "0.2.0",
"author": "Simon Murtha Smith <simon@murtha-smith.com>",
"keywords": ["fitbit"],
"main" : "lib/fitbit_client.js",
"directories" : { "lib" : "./lib" },
"dependencies": {
"oauth": ">= 0.8.2",
"serializer": ">=0.0.2 <0.1.0"
},
"devDependencies": {
"express":">= 3.0.0"
},
"repository" : {"type": "git" , "url": "http://github.com/smurthas/fitbit-js.git" },
"engines": { "node": ">=0.8.0 <0.9.0" }
"name": "fitbit-js",
"description": "Simple FitBit API client",
"version": "0.3.0",
"author": "Simon Murtha Smith <simon@murtha-smith.com>",
"keywords": ["fitbit"],
"main" : "lib/fitbit_client.js",
"directories" : {
"lib" : "./lib"
},
"dependencies": {
"oauth": ">= 0.8.2",
"serializer": ">=0.0.2 <0.1.0"
},
"devDependencies": {
"express":">= 3.0.0"
},
"repository" : {
"type": "git" ,
"url": "http://github.com/smurthas/fitbit-js.git"
},
"engines": {
"node": ">=0.8.0 <0.9.0"
}
}

@@ -27,6 +27,6 @@ # fitbit-js

npm install
cd test
node test.js [Consumer Key] [Consumer Secret]
cd example
node test.js [Consumer Key] [Consumer Secret] [Unit System (en_US or en_GB)](optional. Defaults to metric units)
```
open [http://localhost:8553](http://localhost:8553)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc