Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling request from Unity Facebook SDK #73

Open
luzan opened this issue Apr 28, 2017 · 1 comment
Open

Handling request from Unity Facebook SDK #73

luzan opened this issue Apr 28, 2017 · 1 comment

Comments

@luzan
Copy link

luzan commented Apr 28, 2017

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.

@kasradzenika
Copy link

@luzan the API expects the token in this format:
http://localhost:3005/api/v1/account/auth/facebook/token/endpoint?access_token=...
or you can include it in your request header

it will not work the way you have it. this is demonstrated at the bottom of the Readme of the repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants