Skip to content

Handling request from Unity Facebook SDK #73

Description

@luzan

After long time on research for the solution to my problem, I am still unable to get the solution. Facebook token comes from the Unity Facebook SDK.
This is on my index.js

passport.use(new FacebookTokenStrategy({
    clientID: FACEBOOK_APP_ID,
    clientSecret: FACEBOOK_APP_SECRET
  }, function(accessToken, refreshToken, profile, done) {
    Account.findOrCreate({facebookId: profile.id}, function (error, user) {
      return done(error, user);
    });
  }
));

This is the api

api.get('/auth/facebook/token/:access_token/endpoint', 
passport.authenticate('facebook-token'),
  function (req, res) {
    console.log(req.user);
    // do something with req.user
    res.send(req.user? 200 : 401);
  }
);

But when I make GET request from Postman with this api, only thing i get is Unauthorized

http://localhost:3005/api/v1/account/auth/facebook/token/{token}/endpoint

How can i make this work? Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions