2017-05-09 163 views
0

我有越来越大的一个项目,我想用流星帐户,Facebook的包登录,但它显示错误666流星Facebook的错误666

我对用户的Facebook的信息已经完全访问权限试图登录,但是当Accounts.validateLoginAttempt()被调用它的代码返回一个错误666

我从来没有见过那样的错误,并没有任何地方有这种事的!

这里是我的日志:

I20170509-09:14:53.403(-3)? ***options onCreateUser { profile: { name: 'Rafael Melo' } } 
I20170509-09:14:53.420(-3)? ***user onCreateUser { createdAt: Tue May 09 2017 09:14:53 GMT-0300 (Hora Padrão da Bahia), 
I20170509-09:14:53.421(-3)? _id: 'S7a78CctLco7pddTQ', 
I20170509-09:14:53.421(-3)? services: 
I20170509-09:14:53.421(-3)? { facebook: 
I20170509-09:14:53.422(-3)?  { accessToken: 'xxxxxx', 
I20170509-09:14:53.422(-3)?   expiresAt: 1499436988665, 
I20170509-09:14:53.423(-3)?   id: 'xxxx', 
I20170509-09:14:53.423(-3)?   email: '[email protected]', 
I20170509-09:14:53.424(-3)?   name: 'Rafael Melo', 
I20170509-09:14:53.424(-3)?   first_name: 'Rafael', 
I20170509-09:14:53.440(-3)?   last_name: 'Melo', 
I20170509-09:14:53.441(-3)?   link: 'https://www.facebook.com/app_scoped_user_id/xxxxx/', 
I20170509-09:14:53.448(-3)?   gender: 'male', 
I20170509-09:14:53.454(-3)?   locale: 'en_US', 
I20170509-09:14:53.456(-3)?   age_range: [Object] } } } 
I20170509-09:14:53.840(-3)? ********Results? { statusCode: 200, 
I20170509-09:14:53.841(-3)? content: '{"first_name":"Rafael","last_name":"Melo","picture":{"data":{"is_silhouette":false,"url":"https:\\/\\/scontent.xx.fbcdn.net\\/v\\/t1.0-1\\/p50x50\\/xxxxx.jpg?oh=xxxx&oe=xxxx"}},"email":"xxx\\u0040xxxxx.com","gender":"male","locale":"en_US","link":"https:\\/\\/www.facebook.com\\/app_scoped_user_id\\/xxx\\/","id":"xxx"}', 
I20170509-09:14:53.842(-3)? headers: 
I20170509-09:14:53.842(-3)? { 'access-control-allow-origin': '*', 
I20170509-09:14:53.843(-3)?  etag: '"3befwqdwqd7b4198656bb0c5cb"', 
I20170509-09:14:53.844(-3)?  pragma: 'no-cache', 
I20170509-09:14:53.845(-3)?  'cache-control': 'private, no-cache, no-store, must-revalidate', 
I20170509-09:14:53.847(-3)?  'x-fb-rev': '303217', 
I20170509-09:14:53.848(-3)?  'content-type': 'text/javascript; charset=UTF-8', 
I20170509-09:14:53.848(-3)?  'x-fb-trace-id': 'wqsdsa2mf9/', 
I20170509-09:14:53.850(-3)?  'facebook-api-version': 'v2.7', 
I20170509-09:14:53.862(-3)?  expires: 'Sat, 01 Jan 2000 00:00:00 GMT', 
I20170509-09:14:53.862(-3)?  vary: 'Accept-Encoding', 
I20170509-09:14:53.865(-3)?  'x-fb-debug': '2esdwqdasd/asdqdwqdqwd==', 
I20170509-09:14:53.866(-3)?  date: 'Tue, 09 May 2017 12:14:52 GMT', 
I20170509-09:14:53.867(-3)?  connection: 'close' }, 
I20170509-09:14:53.868(-3)? data: 
I20170509-09:14:53.868(-3)? { first_name: 'Rafael', 
I20170509-09:14:53.869(-3)?  last_name: 'Melo', 
I20170509-09:14:53.879(-3)?  picture: { data: [Object] }, 
I20170509-09:14:53.880(-3)?  email: '[email protected]', 
I20170509-09:14:53.881(-3)?  gender: 'male', 
I20170509-09:14:53.881(-3)?  locale: 'en_US', 
I20170509-09:14:53.882(-3)?  link: 'https://www.facebook.com/app_scoped_user_id/xxxxxxxxxxx/', 
I20170509-09:14:53.883(-3)?  id: 'xxxxxxxxxxx' } } 
I20170509-09:14:53.996(-3)? *****attempt { type: 'unknown', 
I20170509-09:14:53.997(-3)? allowed: false, 
I20170509-09:14:53.998(-3)? methodName: 'login', 
I20170509-09:14:53.999(-3)? methodArguments: [ { oauth: [Object] } ], 
I20170509-09:14:53.999(-3)? error: 
I20170509-09:14:54.000(-3)? { [Error: {"_id":"S7a78CctLco7pddTQ","services":{"facebook":{"accessToken":"23dscxxxxxxxxxxxxxxxx","expiresAt":1499436988665,"id":"xxxxxxxxxxx","email":"[email protected]","name":"Rafael Melo","first_name":"Rafael","last_name":"Melo","link":"https://www.facebook.com/app_scoped_user_id/xxxxxxxxxxx/","gender":"male","locale":"en_US","age_range":{"min":21}}},"emails":[{"address":"[email protected]","verified":true}],"profile":{"nome":"Rafael Melo","sexo":"Masculino"},"email":"[email protected]"} [666]] 
I20170509-09:14:54.001(-3)?  error: 666, 
I20170509-09:14:54.001(-3)?  reason: '{"_id":"S7a78CctLco7pddTQ","services":{"facebook":{"accessToken":"23dscxxxxxxxxxxxxxxxx","expiresAt":1499436988665,"id":"xxxxxxxxxxx","email":"[email protected]","name":"Rafael Melo","first_name":"Rafael","last_name":"Melo","link":"https://www.facebook.com/app_scoped_user_id/xxxxxxxxxxx/","gender":"male","locale":"en_US","age_range":{"min":21}}},"emails":[{"address":"[email protected]","verified":true}],"profile":{"nome":"Rafael Melo","sexo":"Masculino"},"email":"[email protected]"}', 
I20170509-09:14:54.002(-3)?  details: undefined, 
I20170509-09:14:54.003(-3)?  message: '{"_id":"S7a78CctLco7pddTQ","services":{"facebook":{"accessToken":"23dscxxxxxxxxxxxxxxxx","expiresAt":1499436988665,"id":"xxxxxxxxxxx","email":"[email protected]","name":"Rafael Melo","first_name":"Rafael","last_name":"Melo","link":"https://www.facebook.com/app_scoped_user_id/xxxxxxxxxxx/","gender":"male","locale":"en_US","age_range":{"min":21}}},"emails":[{"address":"[email protected]","verified":true}],"profile":{"nome":"Rafael Melo","sexo":"Masculino"},"email":"[email protected]"}', 
I20170509-09:14:54.013(-3)?  errorType: 'Meteor.Error' }, 

我使用流星帐户Facebook的包。

编辑: 的onClick:

Meteor.loginWithFacebook({ 
      requestPermissions: ['public_profile', 'email'] 
     }, function(error) { 
       if (error) { 
       Session.set('errorMessage', error.reason || 'Unknown error'); 
       console.log("error", Session.get('errorMessage')); 
       } else { 
       console.log("Succeso FB!!") 
      } 
     }); 

挂钩:

Accounts.onCreateUser(function (options, user) { 
     console.log("***options onCreateUser", options); 
     console.log("***user onCreateUser", user) 

     if (user.hasOwnProperty('services') && user.services.hasOwnProperty('facebook') ) { 
      let result = Meteor.http.get('https://graph.facebook.com/v2.7/' + user.services.facebook.id + '?access_token=' + user.services.facebook.accessToken + '&fields=first_name, last_name, picture, email, gender, locale, link'); 
      console.log("********Results?", result); 

      let doc = { 
         _id: user._id, 
         services: user.services, 
         emails: [], 
         profile:{} 
         }, 
       fullNome = result.data.first_name + " " + result.data.last_name; 

      doc.profile = { 
           index: '0', 
           nome: fullNome, 
           role: 'Usuário', 
           isValid: true, 
           isComplete: true, 
           imageId: '', 
          } 
      doc.emails.push({ address:result.data.email, verified: true }); 

      console.log("***Doc no onCreateUser", doc); 
      Meteor.users.simpleSchema().clean(doc); 
      Schemas.User.validate(doc); 
      check(doc, Meteor.users.simpleSchema()) 
      user = doc; 

      return user; 

     } 
     else{ 
      return user; 
     } 
    }); 

    Accounts.validateLoginAttempt(function(attempt){ 
     console.log("*****attempt", attempt); 
    }); 

    Accounts.config({ 
     sendVerificationEmail: false, 
     loginExpirationInDays: 10, 
     forbidClientAccountCreation: false 
    }); 

包:如果faulsy返回值

accounts-base        1.2.14* A user account system 
accounts-facebook       1.1.0* Login service for Facebook accounts 
accounts-password       1.3.0* Password support for accounts 
alanning:roles        1.2.15* Authorization package for Meteor 
aldeed:autoform        5.8.1* Easily create forms with automatic insert and update, and aut... 
aldeed:autoform-select2      1.0.5* Custom select2 input type for AutoForm 
aldeed:collection2       2.10.0 Automatic validation of insert and update operations on the ... 
aldeed:http-fix        0.2.2+ Improves the core HTTP package 
aldeed:moment-timezone      0.4.0 Timezone support for moment.js, packaged for Meteor. See http... 
aldeed:simple-schema      1.5.3 A simple schema validation object with reactivity. Used by co... 
aldeed:template-extension     4.0.0* Adds template features currently missing from the templating ... 
ashutosh:email-att       1.1.4 Send e-mails with attachments. 
benjaminrh:event-hooks      1.4.3 Provides hooks for various user-triggered events 
benjaminrh:jquery-cookie     0.1.0 A simple, lightweight jQuery plugin for reading, writing and ... 
benjick:webcam        0.0.2 WebcamJS for Meteor 
bigdsk:inputmask       3.1.63* JQuery InputMask for Meteor 
cordova:cordova-plugin-android-permissions 0.10.0 
cordova:cordova-plugin-camera    2.4.1 
cordova:cordova-plugin-compat    1.1.0 
cordova:cordova-plugin-crop-on-steroids  1.0.0 
cordova:cordova-plugin-file     4.3.2 
cordova:cordova-plugin-file-transfer  1.6.2 
dburles:collection-helpers     1.0.4* Transform your collections with helpers that you define 
dburles:google-maps       1.1.5 Google Maps Javascript API v3 
dschulz:jquery-qrcode      1.0.2 jQuery.qrcode - a jQuery plugin for dynamically generating QR... 
ecmascript         0.6.2* Compiler plugin that supports ES2015+ in all .js files 
email          1.1.17_1* Send email messages 
es5-shim         4.6.15 Shims and polyfills to improve ECMAScript 5 support 
fortawesome:fontawesome      4.5.0* Font Awesome (official): 500+ scalable vector icons, customiz... 
francocatena:status       1.5.3 Displays the connection status between browser and server 
gadicohen:phantomjs       0.0.2 phantomjs installation script; wrapper for node phantomjs pac... 
gibson:meteor-autonumeric     0.0.2 Add jquery-autoNumeric library support 
ground:db         0.3.15 Ground Meteor.Collections offline 
hilios:jquery.countdown      2.0.4 The Final Countdown plugin for jQuery 
http          1.2.11* Make HTTP calls to remote servers 
iron:router         1.0.13* Routing specifically designed for Meteor 
jaywon:meteor-node-uuid      1.0.1 Generate RFC compliant UUIDs using node-uuid. 
jeremy:selectize       0.12.1_5 Selectize is a hybrid of a textbox and <select> element us... 
jesperwe:bootstrap-select     1.7.4_4 Meteor wrapper for http://silviomoreto.github.io/bootstrap-... 
jparker:crypto-md5       0.1.1 MD5 algorithm for CryptoJS, standard secure algorithms 
jquery          1.11.9* Manipulate the DOM using CSS selectors 
kadira:debug        3.2.2 Full Stack Debugging Solution for Meteor 
kadira:dochead        1.5.0 Isomorphic way to manipulate document.head for Meteor apps 
kevohagan:sweetalert      1.0.0 a beautiful replacement for javascript's alert() 
lepozepo:accounting       1.0.0 Accounting.js - number, money and currency formatting - full... 
lukemadera:social-share      1.2.0 Cross platform (inc. Cordova) social sharing for facebook, tw... 
markoshust:owl-carousel-2     2.0.0-beta.3a Owl Carousel 2 
matb33:collection-hooks      0.8.4 Extends Mongo.Collection with before/after hooks for insert/u... 
matteodem:easy-search      2.0.0 Easy-to-use search with Blaze Components (+ Elastic Search su... 
meteor-base         1.0.4 Packages that every Meteor app needs 
meteor-platform        1.2.6 (Deprecated) Include a standard set of Meteor packages in you... 
meteorhacks:aggregate      1.3.0 Proper MongoDB aggregations support for Meteor 
meteorhacks:async       1.0.0 Set of async utilities to work with NPM modules and other asy... 
meteorhacks:kadira       2.30.0* Performance Monitoring for Meteor 
meteorhacks:npm        1.5.0 Use npm modules with your Meteor App 
meteorhacks:picker       1.0.3 Server Side Router for Meteor 
meteorhacks:ssr        2.2.0 Server Side Rendering for Meteor with Blaze 
meteorhacks:subs-manager     1.6.4 Subscriptions Manager for Meteor 
meteorhacks:zones       1.6.0 Zone.Js integration for meteor 
meteortoys:allthings      3.0.0 Insanely Handy Development Tools 
mizzao:autocomplete       0.5.1 Client/server autocompletion designed for Meteor's collection... 
mobile-experience       1.0.4 Packages for a great mobile user experience 
mologie:reactive-selectize     0.1.5 Keeps selectize.js's options in sync with a reactive data source 
momentjs:moment        2.14.4* Moment.js (official): parse, validate, manipulate, and displ... 
mongo          1.1.15* Adaptor for using MongoDB and Minimongo over DDP 
mrt:external-file-loader     0.1.4 The External File Loader package helps easily load external j... 
mystor:device-detection      0.2.0 Client-Side Device Type Detection & Template Switching with O... 
natestrauser:select2      3.5.1* Select2 is a jQuery based replacement for select boxes. 
nicolaslopezj:excel-export     1.0.0 Export data to excel 
numeral:numeral        1.5.3_1 Numeral.js (official) - A library for formatting and manipu... 
peerlibrary:fs        0.1.7 fs node.js module with fiber-enabled synchronous functions 
peppelg:bootstrap-3-modal     1.0.4 Simple usage of bootstrap 3 modals. 
percolate:momentum-iron-router    0.7.0 A momentum plugin for transitioning Iron Router pages 
praxie:canvas-to-blob      1.1.1 JavaScript Canvas to Blob is a function to convert canvas ele... 
raix:handlebar-helpers      0.2.5 Handlebar helpers 
rajit:bootstrap3-datepicker     1.5.1* Meteor packaging of eternicode/bootstrap-datepicker for Boots... 
rajit:bootstrap3-datepicker-pt-br   1.5.1* Meteor packaging of Brazilian translation of eternicode/boots... 
reactive-var        1.0.10* Reactive variable 
reywood:publish-composite     1.4.2* Publish a set of related documents from multiple collections ... 
rzymek:moment-locale-pt-br     2.12.0* Moment.js pt-br locale. Companion package for rzymek:moment 
sacha:spin         2.3.1 Simple spinner package for Meteor 
sergeyt:typeahead       0.11.1_9 Autocomplete package for meteor powered by twitter typeahe... 
service-configuration      1.0.11 Manage the configuration for third-party services 
session          1.1.6* Session variable 
sewdn:jquery-cropper      1.0.0_1 Fengyuan Chen's terrific jQuery plugin for cropping/zooming... 
shell-server        0.2.1* Server-side component of the `meteor shell` command. 
spiderable         1.0.13 Makes the application crawlable to web spiders 
standard-minifier-css      1.2.0_1* Standard css minifier used with Meteor apps by default. 
standard-minifier-js      1.2.0_1* Standard javascript minifiers used with Meteor apps by defa... 
summernote:summernote      0.8.1 summernote (official): jQuery+Bootstrap WYSIWYG editor with e... 
tracker          1.1.2* Dependency tracker to allow reactive callbacks 
tsega:bootstrap3-datetimepicker    4.17.37_1 Bootstrap 3 DateTime picker from @Eonasdan, packaged for ... 
twbs:bootstrap        3.3.6 The most popular front-end framework for developing responsiv... 
u2622:persistent-session     0.4.4 Persistently store Session data on the client 
usefulio:sync-methods      0.2.0 Adds Meteor.syncMethods that lets you call an asynchonous ser... 
vsivsi:file-collection      1.3.6* Collections that efficiently store files using MongoDB GridFS... 
williamledoux:bootstrap-toggle    2.2.1 Bootstrap Toggle Meteor component 
xmlbuilder         2.5.14* An XML builder for node.js similar to java-xmlbuilder. 
yogiben:autoform-modals      0.3.8 Create, update and delete collections with modals 
yogiben:helpers        0.0.6 Meteor helpers that should come as standard 
zimme:active-route       2.0.4_1* Active route helpers 
zimme:select2-bootstrap3-css    1.4.6 CSS to make Select2 fit in with Bootstrap 3 
+0

你钩入'Accounts.validateLoginAttempt'吗?你能显示你使用的代码吗? –

+0

是的,我做了钩子,我编辑显示我的代码! –

+0

你还可以提供你使用哪些软件包,包括他们的版本吗? –

回答

0

Accounts.validateLoginAttempt将下降的登录尝试。更多有关https://docs.meteor.com/api/accounts-multi.html#AccountsServer-validateLoginAttempt

所以你的情况,如果你想只显示结果,你应该做的

Accounts.validateLoginAttempt(function(attempt){ 
    console.log("*****attempt", attempt); 
    return true; 
}); 

其次,在Facebook的API的一些变化(我们甚至有因为内部服务器错误!那个),所以我建议更新到最新的帐户,Facebook的:

meteor update accounts-facebook 

如果更新不更改版本,更新它通过手动编辑.meteor/versions文件

+0

所以,我说“返回true”到一部分,但没有奏效。它使表示: '*****尝试{类型:“未知”, 允许的:假的,' 即使我改回真 –

+0

@RafaelMelo尝试也更新包,如果没”将不起作用 - 尝试也注释掉的代码的很大一部分,你要更换'user'对象,追查下错误 –

+0

我已经删除了这部分你说的和错误持续发生并没有什么改变,连日志等于。我也试图更新包(没有工作),但我的流星释放它的建议,我用的版本,所以我再次降级... –