1

I have a meteor app, with packages :

useraccounts:bootstrap; 
service-configuration; 
accounts-facebook; 

The facebook side was configured to allow requests from localhost. When using the register/signin with facebook from the atForm, a popup appears

EDIT

The popup is actually not empty but displays a message 'login complete, click to close' but closed fast because that's how I configured it on the facebook side.

And the console logs an error:

Exception while invoking method 'login' undefined

EDIT

Here is the service conf:

ServiceConfiguration.configurations.remove({
    service: 'facebook'
});
ServiceConfiguration.configurations.insert({
    service: 'facebook',
    appId: 'removed',
    secret: 'removed'
});

EDIT

Here is the client side code :

Template.atForm.events({
    'click #at-facebook': function(event) {
        console.log("facebook click");
        Meteor.loginWithFacebook({
          requestPermissions: ['email', 'user_friends']
          }, function (err) {
          if (err)
            Session.set('errorMessage', err.reason || 'Unknown error');
        });
    }
});

EDIT When registering with facebook the user created is as follow :

{ createdAt: Thu Jan 21 2016 16:00:08 GMT+0100 (CET),
I20160121-16:00:08.108(1)?   _id: 'Kgs3WswMdB9hsxMfp',
I20160121-16:00:08.108(1)?   services: 
I20160121-16:00:08.108(1)?    { facebook: 
I20160121-16:00:08.108(1)?       { accessToken: 'removed',
I20160121-16:00:08.108(1)?         expiresAt: 1458562023670,
I20160121-16:00:08.109(1)?         id: 'removed',
I20160121-16:00:08.109(1)?         email: 'removed',
I20160121-16:00:08.109(1)?         name: 'Mathieu Kudla',
I20160121-16:00:08.109(1)?         first_name: 'Mathieu',
I20160121-16:00:08.110(1)?         last_name: 'Kudla',
I20160121-16:00:08.110(1)?         link: 'https://www.facebook.com/app_scoped_user_id/removed/',
I20160121-16:00:08.110(1)?         gender: 'male',
I20160121-16:00:08.110(1)?         locale: 'fr_FR',
I20160121-16:00:08.110(1)?         age_range: [Object] } } }

This seems to indicate that the facebook handshake was successful?

What is causing that error? Thanks :)

4

1 回答 1

0

好的,我有点解决了。

我深入研究了登录尝试,发现 oauth 服务未与用户正确配对。我不知道为什么会这样,或者是否有更好的解决方案,但我添加了以下行:

if (user.services) { var service = _.pairs(user.services)[0]; }

到我的 onCreateUser 挂钩并在返回之前正确附加用户对象。它似乎已经成功了,但我不知道我第一次做错了什么......

于 2016-01-21T16:51:27.890 回答