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

fitbit-client-oauth2

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fitbit-client-oauth2

A fitbit client using OAuth 2.0 authentication.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Fitbit client

An OAuth 2.0 client to consume Fitbit's API.

Usage

Using an existing user token

var FitbitClient = require('fitbit-client-oauth2');

var client = new FitbitClient(<YOUR_FITBIT_API_KEY>, <YOUR_FITBIT_API_SECRET> );

// retrieve previously saved user's token from db
client.setTokens(access_token, refresh_token, expires_in);

client.getTimeSeries().then(function(res) {

    console.log('results: ', res);

}).catch(function(err) {
    console.log('error getting user data', err);
});

Refreshing an expired user token

    client.refreshAccessToken().then(function(token) {
    
        // save new token data to db
        // do more stuff here.
    
    }).catch(function(err) {
      console.log('error refreshing user token', err);
    });

TODO

  • Implement full OAuth authorization code flow. (now it relays on passport-fitbit-oauth2).
  • Cover more of the Fitbit API endpoints
  • Add token expiration event to the client (EventEmitter).
  • Implement automatic retries on token expiration errors

Keywords

FAQs

Package last updated on 30 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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