Node.js API for command-line applications that need to authenticate via the Strava V3 API.
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);
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.
npm install --save strava-v3-cli-authenticator
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 |
"read", "activity:write", etc. See http://developers.strava.com/docs/authentication/#details-about-requesting-access |
options.httpPort | number |
Local port used for the Strava redirect with the Strava auth code. |
handleAccessToken | function |
Callback that is passed (error, accessToken). |
ISC