examples icon indicating copy to clipboard operation
examples copied to clipboard

Passport.js

Open CorentinDy opened this issue 9 years ago • 4 comments

Example with passport.js is not working

TypeError: next is not a function
    at Strategy.strategy.error (C:\Users\pc-dev\Documents\node_modules\passport\lib\middleware\authenticate.js:343:9)
    at C:\Users\pc-dev\Documents\node_modules\passport-oauth1\lib\strategy.js:244:30
    at C:\Users\pc-dev\Documents\node_modules\oauth\lib\oauth.js:543:17
    at passBackControl (C:\Users\pc-dev\Documents\node_modules\oauth\lib\oauth.js:397:13)
    at IncomingMessage.<anonymous> (C:\Users\pc-dev\Documents\node_modules\oauth\lib\oauth.js:409:9)
    at emitNone (events.js:110:20)
    at IncomingMessage.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1045:12)
    at _combinedTickCallback (internal/process/next_tick.js:102:11)
    at process._tickCallback (internal/process/next_tick.js:161:9)
======= 2017-06-23 15:28:18: TypeError: next is not a function TypeError: next is not a function
    at Strategy.strategy.error (C:\Users\pc-dev\Documents\node_modules\passport\lib\middleware\authenticate.js:343:9)
    at C:\Users\pc-dev\Documents\node_modules\passport-oauth1\lib\strategy.js:244:30
    at C:\Users\pc-dev\Documents\node_modules\oauth\lib\oauth.js:543:17
    at passBackControl (C:\Users\pc-dev\Documents\node_modules\oauth\lib\oauth.js:397:13)
    at IncomingMessage.<anonymous> (C:\Users\pc-dev\Documents\node_modules\oauth\lib\oauth.js:409:9)
    at emitNone (events.js:110:20)
    at IncomingMessage.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1045:12)
    at _combinedTickCallback (internal/process/next_tick.js:102:11)
    at process._tickCallback (internal/process/next_tick.js:161:9)

Is it linked with this ? IMPORTANT: Twitter doesn't return (after you logged) a PORT number (127.0.0.1/login/callback/... you must rewrite to -> 127.0.0.1:8000/login/callback/...)

CorentinDy avatar Jun 23 '17 13:06 CorentinDy

Hi can you try to change this line https://github.com/totaljs/examples/blob/master/passport.js/controllers/default.js#L22

to this

passport.authenticate('twitter')(self.req, self.res, function(err, status){
        // handle Auth error here
});

Are you using failWithError option?

molda avatar Jun 23 '17 14:06 molda

Just add console.log(err) to passport.authenticate and here is the output

Error: Could not authenticate you.
    at Strategy.parseErrorResponse (C:\Users\pc-dev\Documents\node_modules\passport-twitter\lib\strategy.js:202:14)
    at Strategy.OAuthStrategy._createOAuthError (C:\Users\pc-dev\Documents\node_modules\passport-oauth1\lib\strategy.js:393:16)
    at C:\Users\pc-dev\Documents\node_modules\passport-oauth1\lib\strategy.js:244:41
    at C:\Users\pc-dev\Documents\node_modules\oauth\lib\oauth.js:543:17
    at passBackControl (C:\Users\pc-dev\Documents\node_modules\oauth\lib\oauth.js:397:13)
    at IncomingMessage.<anonymous> (C:\Users\pc-dev\Documents\node_modules\oauth\lib\oauth.js:409:9)
    at emitNone (events.js:110:20)
    at IncomingMessage.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1045:12)
    at _combinedTickCallback (internal/process/next_tick.js:102:11)

I'm not using failWithError (don't know what it is) , just trying to launch sample and learn structure of Total.js app

CorentinDy avatar Jun 26 '17 09:06 CorentinDy

@Kingbalou I'll test it today later.

petersirka avatar Jun 26 '17 14:06 petersirka

@petersirka any fixes in this error ?

Thanks

rlaurente avatar Jan 31 '19 10:01 rlaurente