Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
How to get facebook user information using nodejs (oauth)

I am trying to fetch facebook user information using node-oauth but its giving missing page error on the browser when i am trying to perform oauth

Code oauth2.getAuthorize call:

app.get("/facebook/auth", (req, res) => {
  var redirect_uri = "https://localhost:3000/facebook/callback"
  var params = {
    redirect_uri: redirect_uri,
    scope: "user_about_me,publish_actions",
  };
  res.redirect(oauth2.getAuthorizeUrl(params));
});

Call to read code and access_token in oauth-redirected page

app.get("/facebook/callback", function (req, res) {
  if (req.error_reason) {
    res.send(req.error_reason);
  }
  if (req.query.code) {
    var loginCode = req.query.code;
    var redirect_uri = "https://localhost:3000/facebook/callback";
    oauth2.getOAuthAccessToken(
      loginCode,
      { grant_type: "authorization_code", redirect_uri: redirect_uri },
      function (err, accessToken, refreshToken, params) {
        if (err) {
          console.error(err);
          res.send(err);
        }
        var access_token = accessToken;
        var expires = params.expires;
        req.session.access_token = access_token;
        req.session.expires = expires;
      }
    );
  }
});

Error page: enter image description here

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!