mjhea0/passport-examples

Callback error

Closed this issue · 6 comments

Hi, I'm new in node and trying to sget a simple fb authentication work
here is my code

unfortunately the callback ... function(accessToken, refreshToken, profile, done) is not fired
What did go wrong in here?

thanks for your help

/**
 * Module dependencies.
 */

var express = require('express');
var routes = require('./routes');
var user = require('./routes/user');
var facebook = require('./routes/facebook');
var http = require('http');
var path = require('path');
var passport = require('passport')
var FacebookStrategy = require('passport-facebook').Strategy;
var app = express();
var config = require("./oauth");
// all environments
app.set('port', process.env.PORT || 8080);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(express.cookieParser('your secret here'));
app.use(express.session());
app.use(passport.initialize());
app.use(passport.session());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));

passport.use(new FacebookStrategy({
    clientID: config.facebook.clientID,
    clientSecret: config.facebook.clientSecret,
    callbackURL: config.facebook.callbackURL
  },
  function(accessToken, refreshToken, profile, done) {
    console.log("accessToken" + accessToken);
    console.log(refreshToken);
    console.log(profile);
    console.log(done);
  }
));
// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

app.get('/', routes.index);
app.get('/users', user.list);
app.get('/auth/facebook', 
     passport.authenticate('facebook', { scope: ['read_stream', 'publish_actions'] })
);
app.get('/auth/facebook/callback', facebook.callback);

http.createServer(app).listen(app.get('port'), function(){
  console.log('Express server listening on port ' + app.get('port'));
});

Can I see your project? Is it on Github?

did you read the blog post? if not, please read it. you will find out exactly what you are doing wrong.

I think I did a couple of time but couldn't find out.
I've already done what you have written in the readme file.

I'm quite new so if you can walk me through, would be great...
thanks

2014/1/13 Michael Herman notifications@github.com

did you read the blog post? if not, please read it. you will find out
exactly what you are doing wrong.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-32197229
.

I'm sorry, but it's clear you did not follow the blog post as you did not do step 2. I usually would help, but I am super busy. Go through the blog post, start to finish. Then connect back with me. DO NOT just download the sample project. You will not learn anything.

Let's take this off of github. Email me at michael@mherman.org for future assistance. Best!

no problem.

Thank you for your time

2014/1/13 Michael Herman notifications@github.com

I'm sorry, but it's clear you did not follow the blog post as you did not
do step 2. I usually would help, but I am super busy. Go through the blog
post, start to finish. Then connect back with me. DO NOT just download the
sample project. You will not learn anything.

Let's take this off of github. Email me at michael@mherman.org for future
assistance. Best!


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-32201144
.