Facebook - A simple example #234

Closed
alexgenovese opened this Issue Apr 7, 2012 · 4 comments

Projects

None yet

3 participants

@alexgenovese

Hello,
I'm trying to write something simple with everyauth.
I need to connect by my appid and appsecret and use the graph API of Facebook.

This is the code:

var everyauth = require('everyauth')

everyauth.facebook
  .appId(APP ID)
  .appSecret(APP SECRET)
  .handleAuthCallbackError( function (req, res) {
    // If a user denies your app, Facebook will redirect the user to
    // /auth/facebook/callback?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request.
    // This configurable route handler defines how you want to respond to
    // that.
    // If you do not configure this, everyauth renders a default fallback
    // view notifying the user that their authentication failed and why.
    console.log(res);
  })
  .findOrCreateUser( function (session, accessToken, accessTokExtra, fbUserMetadata) {
    // find or create user logic goes here
  })
  .redirectPath('/');

Thanks in advance.
-A

everyauth is only responsible for authentication, actually using facebook api is not handled with everyauth i believe.

WOW!! :( do you know something like everyauth for all socials ? Or I must create one by myself ?

you may create one if you want, i don't think there is one that handles everything

Owner

Everyauth only handles authorization with Facebook Connect. It provides you with the user's access_token, which is accessible from the request's session via req.session.auth.facebook.accessToken, once a user has connected via Facebook Connect. You use this in tandem with the npm package of your choice for Facebook's Graph API.

@bnoguchi bnoguchi closed this Apr 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment