Git Product home page Git Product logo

strava-v3-cli-authenticator's Introduction

Synopsis

Node.js API for command-line applications that need to authenticate via the Strava V3 API.

Code Example

  var authorize = require('strava-v3-cli-authenticator');

  const options = {
    clientId: 12345,
    clientSecret: 'x5f111xx11yyyy2222z3aa4b5555c6d777e88f9',
    scope: 'write',
    httpPort: 8888
  };
  const callback = (error, accessToken) => {
    if (error) {
      console.error('Failed: ', error);
    } else {
      console.log('Access token: ', accessToken);
    }
  };
  authorize(options, callback);

Motivation

Strava's API is a hassle to use in command-line apps since it depends on pointing the user's browser to Strava, authenticating, then redirecting the brower back to the developer's application with the authentication code. This package gets around that by running a local HTTP server, starting up a browser, and pointing the Strava redirect to the local HTTP server.

Installation

npm install --save strava-v3-cli-authenticator

API Reference

authorize(options, handleAccessToken)

Authorize against the Strava V3 API and return the Strava access token via a callback.

Kind: global function

Param Type Description
options Object
options.clientId string Strava client ID.
options.clientSecret string Strava client secret.
options.scope string "write", "view_private", or the empty string.
options.httpPort number Local port used for the Strava redirect with the Strava auth code.
handleAccessToken function Callback that is passed (error, accessToken).

License

ISC

strava-v3-cli-authenticator's People

Contributors

gabrieldeal avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.