[RESOLVED] IOS Facebook SSO login failed

Hello,
I tried to setup a very simple IOS app with a facebook SSO login. I used accounts-facebook plugin but it doesn’t work.

My server code:

import { Meteor } from 'meteor/meteor';

ServiceConfiguration.configurations.remove({
    service: "facebook"
});

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

Accounts.onCreateUser(function (options, user) {

    if (!user.services.facebook) {
        return user;
    }
    user.username = user.services.facebook.name;
    user.emails = [{address: user.services.facebook.email}];

    return user;
});

My client code:

import { Template } from 'meteor/templating';

import './main.html';

Template.login.helpers({
    getEmail() {
        return Meteor.user().emails && Meteor.user().emails[0].address;
    }
});

Template.login.events({
    'click button.log-in'(event) {
        event.preventDefault();
        Meteor.loginWithFacebook({requestPermissions: ['public_profile', 'email']}, function(err){
            if (err) {
                console.log('Handle errors here: ', err);
            }
        });
    },
    'click button.log-out'(event) {
        event.preventDefault();
        Meteor.logout();
    }
});

I created an application into my facebook developper account page.

I launch my app with this command line: “meteor run ios-device” and in xcode i launch app into a simulator.

Into my app i can click to the button to authenticate myself and for the first time i get the facebook modal to fill-in my login and my password.

When i validated my credentials i obtained this screen, sorry it’s in french so i translate it:

Facebook has detected that paolo-test does not use a secure connection for the transfer of information.

Until paolo-test has updated its security settings, you cannot use Facebook to connect to it

Can someone help me or send me some clue ?

do not hesitate to ask me for details.

thank you very much for your future help.

In your Facebook developer account, your app needs to be set for Development and you can play with test users. Production apps only accept TLS (SSL) connections. From your local station you could use Ngrok and it might work.

Thank you @paulishca, yes your’re right.
I used ngrok as you described to make a secure tunnel (https) and i setup my app into facebook developper page (i had to set meteor ROOT_URL too) with the url endpoint provided by ngrok.
It works now !!!
Thank you very much for your help :wink:

1 Like