Tag: facebook

nodejs护照总是失败的URL

我正在使用护照,允许通过我的网站上的Facebooklogin。 一切似乎工作得很好,但Facebook的网站callback总是去到failureRedirect,即使我从Facebook有回来的所有数据有效的令牌。 任何想法为什么发生这种情况? express = require "express" passport = require 'passport' FBStrategy = require('passport-facebook').Strategy Properties = require "./config.json" FB_APP_ID = REMOVED FB_APP_SECRET = REMOVED passport.serializeUser = (user, done) -> done null, user passport.deserializeUser = (obj, done) -> done null, obj fb = new FBStrategy clientID: FB_APP_ID clientSecret: FB_APP_SECRET callbackURL: "http://localhost/auth/facebook/callback" (accessToken, refreshToken, profile, done) -> […]

Facebook像mongodb中的聊天数据库模式

我正在计划node.js中的TCP / IP聊天服务器,我想包括Facebook / Gmail聊天的几乎所有function。 我有两个想法在数据库模式 – 第一 – 1)当user1开始与user2和user3聊天时,我将检查这些用户以前聊过的数据库(是否有为这些用户创build的空间?),如果不是,那么我将为这些用户创build一个空间。 2)我将保存消息收集聊天消息和每个聊天消息在一个单独的文件,我想保存这些相关的聊天消息味精msg sender_user房间时间戳附件 问题与这种方法 – 1)我检查的方式,如果user1,user2和user3之前聊过(是否有任何房间创build这些之前)所需的“$所有”在查询,这是缓慢的,并没有太多的可扩展性(请参阅我以前的问题 – 数组searchmongodb )。 这个search有没有更好的方法? 第二 – 1)当user1开始与user2和user3聊天时,我将为这个聊天创build一个集合(一个房间的软件),在这个集合中,我将把聊天消息保存在文档中 问题与这种方法 – 1)我应该如何决定收集名称? 我应该把它命名为“user1,user2,user3”吗? 2)我将如何检查由于“user1,user2,user3”与“user2,user3,user1”不同而为user2,user3,user 1创build的collections(房间)? 我也在寻找更多的想法,因为我不完全满意我的方法。 为了获得最大的性能和可扩展性,大型巨头(Facebook,Gmail)如何执行其数据库架构? 任何帮助,我非常感谢。

具有共享/ like / commentfunction的社交网站的mongodb模式?

我正在开发一个社交网站,用户可以在其他function中发布状态,分享/喜欢/评论他人的post。 我正在使用mongodb + nodejs,我遇到了是embedded还是引用用于存储这些数据的文档的问题。 我有一个名为“活动”的集合,它存储用户执行的所有活动,例如share / post / like / comment,以及指定用户执行的活动types的“type”字段。 如果我执行“评论”操作,应该如何存储这些信息? 我希望发表评论的用户也将该post分享给他/她的朋友,以便他们可以看到评论和post。 我是否应该复制与“用户共享”相同的内容并将其embedded到一个types为“share”的新文档中,还是应该只存储对该内容的引用? 示意图,我应该这样做: embedded: var activity = new Schema({ type:String // specifies the type of activity content: [{ // the object that user share/like/comments on. }] }); 要么 2.referencing: var activity = new Schema({ type:String // in this case would be "share", content_id: […]

Angular / Node / Express / Passport – 连接到facebook(CORS)时的问题

我试图在我的NodeJs服务器上使用Facebook身份validation。 我来到http://scotch.io/的教程,并使用REST客户端(邮递员等)在本地工作。 为了改善UI,我使用了Angular JS作为前端。 但是当我调用一个http.get到我在NodeJs后台给出的特定路由时,我在chome和firefox中得到了以下错误: XMLHttpRequest无法加载https://www.facebook.com/dialog/oauth?response_type=code&redirect_uri=http% … 0%2Fapi%2Fauth%2Ffacebook%2Fcallback&scope = email&client_id = 3000000000006。 请求的资源上没有“Access-Control-Allow-Origin”标题。 因此不允许访问原产地“localhost:8080”。 我已经尝试了几个解决scheme在StackOverflow,但它仍然无法正常工作…我的NodeJs使用Express 4. *和一个CORS中间件。 对于Angular,我发现了几种启用CORS的方法,目前为止还没有任何工作。 我希望你能帮助我:D在此先感谢!

看守:加载共享库时出错:libpcre.so.1

我在Ubuntu 15.10上,并且正在使用react-native(0.20.0)开发一个Android(SDK 23)应用程序。 我正在使用节点5.6.0和npm 3.6.0。 运行react-native start时遇到了一个守望者错误 ERROR watchman–no-pretty get-sockname returned with exit code 127 watchman: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory at ChildProcess.<anonymous> (/home/rachael/Dev/InstaGo/node_modules/fb-watchman/index.js:198:18) at emitTwo (events.js:100:13) at ChildProcess.emit (events.js:185:7) at maybeClose (internal/child_process.js:827:16) at Socket.<anonymous> (internal/child_process.js:319:11) at emitOne (events.js:90:13) at Socket.emit (events.js:182:7) at Pipe._onclose […]

通过Graph API将图像发布到Facebook页面时间轴

我想通过Graph API将照片发布到Facebook页面的时间轴上。 我的设置是基于节点的,并用coffeescript编写。 我目前的实现是这样的(error handlingommited): sendImageToFacebookTimeline = (user, message, imageURL, callback)-> url = "https://graph.facebook.com/#{pageID}/photos" params = access_token: user.accessToken url: imageURL message: message request.post({url: url, qs: params}, (err, res, body)-> body = JSON.parse(body) callback(body.id) ) 这成功地张贴照片到我的网页。 但不是出现在时间线上,而是出现在“PAGE的照片”中。 我如何发布到时间轴? 编辑:我发现通过张贴到/ page_id /饲料与选项“图片”,您可以发送照片到时间线。 这与og:image显示方式相同,视图与链接类似。 编辑2:如果你上传到一个相册,它会出现在时间轴上。 我已经创build了一个专辑,并试图发布到它。 但是,在发布到/ album_id / photos时,API似乎不接受源的URL。

在GraphQL中将数组作为parameter passing

我已经开始研究GraphQL。我的模式也包含一个列表项目。 以下是我的模式的代码: var userType = new graphql.GraphQLObjectType({ name: 'user', fields: function () { return { _id: { type: graphql.GraphQLID }, name: { type: graphql.GraphQLString }, age: { type: graphql.GraphQLString }, degrees:[ {type:graphql.GraphQLList} ] } } }); 并且查询如下: var QueryType = new graphql.GraphQLObjectType({ name: 'Query', fields: () => ({ userArr: { type: new graphql.GraphQLList(userType), args:{ degrees:{type:new […]

如何使用create-react-app提供SSL证书?

我正在尝试使用Facebook样板在本地创build和testing一个反应应用程序。 客户端应用程序与我使用node.js制作的API进行交互,并且我没有设置安全连接(使用node.js客户端发送我的SSL证书进行testing)。 然而,我遇到了困难,当谈到使用反应发送我的SSL证书而不是一个自签名的使我遇到这个错误使用铬并试图访问https://example.net:3000 : 您的连接不是私有的(NET:ERR_CERT_AUTHORITY_INVALID) 这个文档对我没有太大的帮助: 请注意,服务器将使用自签名证书,因此您的Web浏览器在访问该页面时几乎肯定会显示警告。 https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#using-https-in-development 我如何使用自己的SSL证书(我已经在我的域名上使用另一个应用程序,像魅力一样),而不是自签名的? 我错过了什么 ?

使用Passport无法使用Facebook进行身份validation

我正在尝试使用我的应用程序进行Facebook身份validation。 但到目前为止,我的尝试是不成功的。 我对Node完全陌生。 当用户点击那个fbloginbutton时,请求被带到/ auth / facebook路由,在那里他们将被传递到Passport策略。 在那里,他们将被发送到Facebook进行身份validation。 但它从来没有发生。 Facebookauthentication窗口永远不会显示。 好像redirect不起作用。 我做了几个小时的search,但没有得到解决scheme。 以下是我认为对这种情况很重要的部分代码 我已经把我的应用程序ID和应用程序的秘密在config / auth.js module.exports = { 'facebookAuth' : { 'clientID' : 'my-AppID-here', 'clientSecret' : 'my-App-secret-here', 'callbackURL' : 'http://localhost:8080/auth/facebook/callback' } }; 使用Facebook进行身份validation并处理callback的策略是config / passport.js var LocalStrategy = require('passport-local').Strategy; var FacebookStrategy = require('passport-facebook').Strategy; // load up the user model and auth variables var User […]

FacebookGraphAPIError:(#100)尝试访问节点types(用户)上的不存在字段(user_photos)

我使用passport.js进行Facebook身份validation,最近我开始出现这个错误。 完整的错误信息如下所示: FacebookGraphAPIError: (#100) Tried accessing nonexisting field (user_photos) on node type (User) at D:\app\node_modules\passport-facebook\lib\strategy.js:167:21 at passBackControl (D:\app\node_modules\passport-facebook\node_modules\passport-oauth2\node_modules\oauth\lib\oauth2.js:124:9) at IncomingMessage.<anonymous> (D:\app\node_modules\passport-facebook\node_modules\passport-oauth2\node_modules\oauth\lib\oauth2.js:143:7) at IncomingMessage.emit (events.js:129:20) at _stream_readable.js:908:16 at process._tickCallback (node.js:355:11) 我尝试了不同的方法来设置权限范围。 最初我宣布了 passport.use(new FacebookStrategy({ profileFields : ['user_photos', 'user_friends'], } 然后我把它移到了 app.get('/auth/facebook', passport.authenticate('facebook', { scope : ['email, public_profile, user_photos, user_friends'] })); 它仍然会导致相同的错误,以及user_friends,如果我删除user_photos。 任何想法,我在做什么错了? 我的authentication脚本的核心来自于本教程https://scotch.io/tutorials/easy-node-authentication-facebook