简体   繁体   English

Facebook应用不适用于新用户

[英]Facebook app not working for new users

I have developed a facebook app in node js which is hosted on heroku. 我已经在heroku上托管的node js中开发了一个facebook应用程序。 It will display some of the users public data.It worked fine for two days but from the next day it is showing an application error for new users but for the users who have already used the app it is working fine.I couldn't understand where the problem lies if I run it locally using "foreman start" or "node web.js" I'm getting an " this web-page has a redirect loop" message only for new users.I have tried it by deleting all the cookies and webpage data also even then I got the same message. 它会显示一些用户的公开数据。它可以正常工作两天,但从第二天起,它向新用户显示应用程序错误,但是对于已经使用该应用程序的用户来说,它可以正常工作。问题出在哪里,如果我使用“ foreman start”或“ node web.js”在本地运行,则会收到仅针对新用户的“此网页具有重定向循环”消息。我已尝试通过删除所有即使是Cookie和网页数据,我也收到相同的消息。 I'm using "facebook-node-sdk" for facebook connect and "ejs" for displaying the web-page and express for server. 我正在使用“ facebook-node-sdk”进行facebook连接,并使用“ ejs”显示网页并进行服务器表达。

App looks like this for old users 老用户的应用看起来像这样

The app is hosted here 该应用程序托管在此处

I couldn't find anything in the logs also. 我也无法在日志中找到任何内容。 Can anyone help me in solving this problem. 谁能帮助我解决这个问题。

The app code: 应用程式码:

var express = require('express');
var Facebook = require('facebook-node-sdk');
var app = express.createServer();
var pic;
var cover;
app.configure(function () {
  app.use(express.bodyParser());
  app.use(express.cookieParser());
  app.use(express.session({ secret: 'password' }));
  app.use(Facebook.middleware({appId:'12345',secret:'12345'}));
});
app.set('view options', { layout: false });
app.set('view engine', 'ejs');
app.get('/', Facebook.loginRequired(), function (req, res) {
        req.facebook.api('/me?fields=picture.type(square)', function(err, pict) {
            pic=pict.picture.data.url;
        });
    req.facebook.api('/me?fields=cover',function(err,cover_pg){
        cover=cover_pg.cover.source;
        });
    req.facebook.api('/me', function(err, user) {
            res.render('home', {locals: {
        title:'Public-Profile', 
        user:user.name , 
            id:user.id, 
        gender:user.gender,
        hometown:user.hometown.name, 
        current:user.location.name,
        link:user.link,
        pic:pic,
        cover:cover
        }
        });
    });
}); 
var port = process.env.PORT || 5000;
app.listen(port, function() {
  console.log("Listening on " + port);
});

The ejs file code: ejs文件代码:

<html>
<head>
<title><%= title %></title>
</head>
<body>
<h3>This app is ment to show all your facebook public profile</h3>
<h3>Welcome:</h3>
<h3><img src=<%= pic %>> <%= user %>   </h3> 
<a href=<%= cover %> target="_blank"><img src=<%= cover %> height="200"></a>
<h3>Your Facebook Id:<%= id %></h3>
<h3>Gender:<%= gender %></h3>
<h3>Your home-town:<%= hometown %></h3>
<h3>Your Current-Location:<%= current %></h3>
<a href=<%= link %> target="_blank"><h2>Visit Your Profile</h2></a>
<br/><br/><br/><br/><br/><br/><br/><br/>
<p>--By Dinesh</p>
<p>This app is still under development it will be ready soon...</p>
</body>
</html>

Here We have lot of option to configure facebook authentication . 在这里,我们有很多选择来配置facebook身份验证。

Use Passsport.js 使用Passsport.js

http://passportjs.org/ http://passportjs.org/

Hope this will work.. 希望这会工作..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Facebook Messenger webhook 不为与应用程序无关的用户发送数据 - Facebook messenger webhook not sending data for users that are not associated with the app Facebook 营销 API 不适用于 App 令牌? - Facebook marketing API not working with App token? NodeJS BookShelf App OAuth 2.0(“验证用户”部分)无法正常工作 - NodeJS BookShelf App OAuth 2.0 (Authenticating Users section) not working 创建 React App 的新反应用户不起作用? - new react user creating React App not working? 如何处理不记得他们是否通过Facebook或Google注册到我的应用程序的用户? - How to handle users who don't remember if they signed up via Facebook OR Google into my app? Discord.js (V12) messageReactionAdd 不适用于新用户,直到他们输入内容 - Discord.js (V12) messageReactionAdd not working for new users until they type something 如何在新版本部署期间保持我的 heroku 应用程序正常工作? - How to keep my heroku app working during new version deployment? 用k均值聚类的Facebook用户 - Clustering of facebook-users with k-means 使用PassortJS将本地用户连接到Facebook / Twitter - Connect Local Users to Facebook/Twitter with PassortJS 使用PassportJS和Connect for NodeJS对Facebook用户进行身份验证 - Using PassportJS with Connect for NodeJS to authenticate Facebook Users
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM