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

Stops callback from running #40

Open
suederade opened this issue Aug 12, 2015 · 6 comments
Open

Stops callback from running #40

suederade opened this issue Aug 12, 2015 · 6 comments

Comments

@suederade
Copy link

I have a post that runs that simply logs out a phrase and whenever the passport.authenticate is authenticating the route, the callback never runs even though authentication passes.

@jaredhanson
Copy link
Owner

What debugging have you done to isolate this issue to this project?

@suederade
Copy link
Author

I took out all the content and made the callback directly in the route with a only a console log saying it fired. I sent it with and without an access token. Without it, it did come back unauthorized, but with it nothing fired. After I took it out, it all worked. I don't necessarily need it because there will be a passport local authorization that I'm using for changing someone's password, but that is beside the point. I've never had this problem before and it works on every other route I have it on, but for some reason this one was different (and it's not really any different).

@jaredhanson
Copy link
Owner

I don't understand what you mean by "took out all the content"? Content in the request, or content in the code?

It might help to post an example of the code that is a simple way to reproduce the issue

Sent from my iPhone

On Aug 13, 2015, at 7:00 AM, Steven Wade [email protected] wrote:

I took out all the content and made the callback directly in the route with a only a console log saying it fired. I sent it with and without an access token. Without it, it did come back unauthorized, but with it nothing fired. After I took it out, it all worked. I don't necessarily need it because there will be a passport local authorization that I'm using for changing someone's password, but that is beside the point. I've never had this problem before and it works on every other route I have it on, but for some reason this one was different (and it's not really any different).


Reply to this email directly or view it on GitHub.

@suederade
Copy link
Author

Works:
app.post('/api/v1/user/changePassword', function(req, res) {console.log('firing'});

Doesn't work:
app.post('/api/v1/user/changePassword', passport.authenticate('bearer', {session: false}), function(req, res) {console.log('firing'});

^ that code will send back an Unauthorized code if the token is not present, but when it is, it doesn't fire the callback.

@jaredhanson
Copy link
Owner

Is your verify callback getting called? Are you calling 'done' within that. I'd suspect not, and that is the cause

Sent from my iPhone

On Aug 14, 2015, at 7:13 AM, Steven Wade [email protected] wrote:

Works:
app.post('/api/v1/user/changePassword', function(req, res) {console.log('firing'});

Doesn't work:
app.post('/api/v1/user/changePassword', passport.authenticate('bearer', {session: false}), function(req, res) {console.log('firing'});

^ that code will give send back an Unauthorized if the token is not present, but when it is, it doesn't fire the callback.


Reply to this email directly or view it on GitHub.

@mk-pmb
Copy link

mk-pmb commented Aug 14, 2015

One more reason to promisifyAll. ;-)

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

3 participants