Issue with Facebook API
Thanks Yuri - much appreciated. I should have looked at the implementation bit more carefully.
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Thanks Yuri - much appreciated. I should have looked at the implementation bit more carefully.
Hi, I am having the same problems. It is logging me into Facebook but if I add the publish_actions to the scope, it is not loading the page at all. What am I doing wrong? Thanks. Here is my code below:
(function(context) {
Helper = {};
var ref;
// var projectId = window.location.href.split("/")[5];
Code: Select all
Helper.init = function() {
var callbackUrl = "[url=http://appery.io/app/view/]http://appery.io/app/view/[/url]" + Facebook_Settings.project_id + "/Login.html?targetPage=Facebook_Me";
var url = "https://www.facebook.com/dialog/oauth...=" + Facebook_Settings['client_id'] + "&redirect_uri="
Code: Select all
if (this.isPhoneGapApp()) {
ref = window.open(url, '_blank', 'location=yes');
ref.addEventListener("loadstart", this.getAccessToken);
} else {
window.open(url, "_self");
}
};
Code: Select all
Helper.getAccessToken = function(event) {
if (event.url.indexOf('access_token') = 0) {
console.log("Extracting access_token...");
var params = event.url.split("access_token=");
var _access_token = params[1].slice(0, params[1].indexOf("&"));
localStorage.setItem('access_token', _access_token);
ref.close();
Appery.navigateTo('Facebook_Me', {});
}
};
Helper.isPhoneGapApp = function() {
return (document.URL.indexOf('a href="http://" rel="nofollow"http:///a') === -1 && document.URL.indexOf('a href="https://" rel="nofollow"https:///a') === -1);
};
if (window.location.href.indexOf("access_token") != -1) {
var hashFromFb = window.location.hash;
window.location.hash = '';
var paramsFromFb = hashFromFb.substring(1).split("&");
var access_token = paramsFromFb[0].split("=")[1];
localStorage.setItem('access_token', access_token);
}
context.Helper = Helper;
})(window);
Hi rodzeus,
It's hard to say what is wrong now,
Please give us your app public link and describe steps to reproduce this problem.
We will take a look.
Regards.