node-strava / node-strava-v3

API wrapper for Strava's v3 API, in Node
MIT License
356 stars 109 forks source link

Connection to strava does not work #90

Closed alex8276 closed 4 years ago

alex8276 commented 4 years ago

Hello, I'm beginner to nodejs and i would like use your package. I don't understand how to work. DO you have a complete tutorial for a beginner ? When I make this:

strava.config({
    "access_token"  : "xxxmyTokenxxx",
    "client_id"     : "xxx",
    "client_secret" : "xxxxxxxxxxxxxxxxxx",
    "redirect_uri"  : "http://localhost:8082",
  });
strava.athlete.get({},function(err,payload,limits) {
        console.log(payload);
    });

I get an 401 error access_token code invalid, I don't understand why ? If I put my token in callback function it's ok ! How to call strava to connect my client ?

regards

nik0kin commented 4 years ago

You need to pass access_token to the endpoint function: strava.athlete.get({ access_token: "xxxmyTokenxxx" }, function () {..