Closed bhanuc closed 10 years ago
What does your /app
route (especially the logic ensuring a logged in user) look like?
@rkusa /app route is mounted on a 2nd router filtered by middleare that checks the the autentication of requests as shown below
app.use(default_router.middleware());
// =====================================
// check the login ==============================
// =====================================
app.use(function* (next) {
if (this.req.isAuthenticated()) {
yield next;
} else {
this.redirect('/login')
}
});
var secured = new Router();
secured.get('/app', function* (){
var userdetails = this.req.user;
this.body = yield render('view.ejs',{ user : userdetails});
})
app.use(secured.middleware())
And here is the request flow from my browser http://s8.postimg.org/gbt0nmfqd/Screenshot_03082014_01_23_24_PM.png http://s8.postimg.org/vyka0ztid/Screenshot_03082014_01_22_10_PM.png
What is the value of authconfig.facebookAuth.callbackURL
?
@rkusa 'facebookAuth' : { 'clientID' : 670657392948407,//'your-secret-clientID-here', // your App ID 'clientSecret' : '1beefd26e84f7e7adb4eb8a371c41af8',//'your-client-secret-here', // your App Secret 'callbackURL' : 'http://localhost:3000/auth/facebook/callback' }
Just saw, that I forgot to update the example to use koa-passport@0.2.0
. Prior to this version you have to add this middleware:
app.use(function*(next) {
this.req.query = this.query // connect compatibility
yield next
})
So I think updating koa-passport
to 0.2.0
or adding this middleware should solve your issue.
Please let me know if it works.
:+1: Works Awesome .. Thanks
@rkusa
I sometime get this error
Error
at Strategy.OAuth2Strategy._createOAuthError (/home/bhanuc/web/dazer/node_modules/passport-facebook/node_modules/passport-oauth2/lib/strategy.js:340:17)
at /home/bhanuc/web/dazer/node_modules/passport-facebook/node_modules/passport-oauth2/lib/strategy.js:173:43
at /home/bhanuc/web/dazer/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:162:18
at ClientRequest.
I am not able to reproduce this error :confused: Have you found a way to manually reproduce this error?
Actually Even I am not able to reciprocte ... I just restarted and it worked fine ... so I thought it might be some error that resulted from my code ... will keep an eye open for this one .. :+1: thanks btw
Hi , I was trying to test the facebook integration but I get redirect loop when I try to login using facebook(after I successfully login) My routes are : //============================================= // route for facebook authentication and login //=============================================
and my authenticate function is :
},