Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get access token #3

Open
ghost opened this issue Oct 16, 2015 · 3 comments
Open

Unable to get access token #3

ghost opened this issue Oct 16, 2015 · 3 comments

Comments

@ghost
Copy link

ghost commented Oct 16, 2015

I'm having trouble with
Failed to obtain access token
I think the problem is likely that I don't have the right stuff in /auth/fitbit/callback

This is what I've got:

app.get('/auth/fitbit',
passport.authenticate('fitbit', { scope: ['activity','heartrate','location','profile'] }
));
app.get('/auth/fitbit/callback', passport.authenticate('fitbit', { failureRedirect: '/?error=auth_failed' }),
function(req, res) {
// Successful authentication, redirect home.
res.redirect('/phone');
}
);

As I said, I suspect I need to do more with the /auth/fitbit/callback portion to actually exchange the code for a token.

@ghost
Copy link

ghost commented Oct 16, 2015

The place to do something with the token is in the callback you've added in the instance passport.use(new FitbitStrategy({..config..}, function() { /* HERE YOU HAVE THE TOKEN */}). In the /auth/fitbit/callback you only need to point to fail/success urls, no need for a callback there.

@ghost
Copy link
Author

ghost commented Oct 16, 2015

Can you provide sample code? I used the code as you had it in the example but I guess it's not complete?

@ghost
Copy link
Author

ghost commented Oct 16, 2015

This is the place where I'm failing to get the access token:

app.get('/auth/fitbit',
passport.authenticate('fitbit', { scope: ['activity','heartrate','location','profile'] }
));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants