問題描述
forge.facebook.authorize 不重定向網站 (forge.facebook.authorize not redirecting for website)
I have a trigger.io app working fine using facebook authentication on Android and iPhone, however, when I publish it locally for web via Chrome clicking on the "Connect to facebook" button does not call the forge.facebook.authorize function. There is no output of it failing either. Help?
forge.logging.info("Facebook pressed!");
forge.facebook.authorize(['email', 'user_birthday', 'user_about_me'], function () {
forge.logging.info("Facebook success");
forge.facebook.api('/me', function (response) {
FBLoginOrCreateAccount(response);
}, function () {
forge.logging.info("facebook graph call failed.");
$(".loading").hide();
});
}, function (e) {
forge.logging.info("facebook failed: " + JSON.stringify(e));
$(".loading").hide();
});
參考解法
方法 1:
Our Facebook SDK integration is for mobile platforms only: http://docs.trigger.io/en/v1.4/modules/facebook.html#facebook-authorize
What you should do is branch your code using forge.is.web() and use Facebook's normal oauth and REST API for your web version.
方法 2:
www.facebook.com
forge.logging.info("Facebook pressed!");
forge.facebook.authorize(['email', 'user_birthday', 'user_about_me'], function () {
forge.logging.info("Facebook success");
forge.facebook.api('/me', function (response) {
FBLoginOrCreateAccount(response);
}, function () {
forge.logging.info("facebook graph call failed.");
$(".loading").hide();
});
}, function (e) {
forge.logging.info("facebook failed: " + JSON.stringify(e));
$(".loading").hide();
});
(by user1551227、Amir Nathoo、Pséèko Slipknot Chahin)