Can I make an app available only to people that like a facebook page? [duplicate] - facebook

This question already has answers here:
How to check if a user likes my Facebook Page or URL using Facebook's API
(5 answers)
Closed 9 years ago.
I have made a facebook App and associated with a page. I only want people that like the page to be able to use the app. Is this possible?

When somebody tries to load your app, they will need to be authorised.
Once authorised, you can query the user's graph to see what they like:
(I've assumed you've authorised using the php sdk, and will have the $facebook object, however the principle is the same for other techniques)
$fanPageId = "xxxxxxxxx";
$appId = "xxxxxxxxxx";
$fanPageLiked = false;
$appLiked = false;
$likes = $facebook->api('me/likes');
foreach ($likes['data'] as $ilike) {
if ($ilike['id'] == $fanPageId) {$fanPageLiked = true;}
if ($ilike['id'] == $appId) {$appLiked = true; }
}
if ($fanPageLiked)
{
.... run your game.
}
else
{
.... redirect to fan page.
}

Related

Dynamic Links not working iOS 15.1 Facebook Swift

Firebase Dynamic Links not working iOS 15.1 for Facebook but working perfectly iOS 14.1. I have tried lot of changes with Dynamic Link parameters. I have checked all parameter configured correctly in the Firebase account and Dynamic link like App BundleId, AppStoreID, AppID and all others parameters.
For iOS 14.1
User post a dynamic link on facebook as a post. When user click on then facebook post redirect to automatically in the app.
For iOS 15.1
User post a dynamic link on facebook as post. When user click on facebook post, the user redirect default Website which i set in the dynamic link url.
User post a dynamic link on facebook as post. When user click on facebook post, the user redirect default Website which i set in the dynamic link url.
Code:-
func createLinkShare1(dynamicLinksDomainURIPrefix:String,link:URL) {
let appBundleID = AppInformation.AppBundleId
if let linkBuilder = DynamicLinkComponents(link: link, domainURIPrefix: dynamicLinksDomainURIPrefix) {
linkBuilder.navigationInfoParameters = DynamicLinkNavigationInfoParameters()
linkBuilder.navigationInfoParameters?.isForcedRedirectEnabled = true
linkBuilder.iOSParameters = DynamicLinkIOSParameters(bundleID: appBundleID)
linkBuilder.iOSParameters?.appStoreID = AppInformation.AppStoreId
linkBuilder.iOSParameters?.minimumAppVersion = AppInformation.AppMinimumVersion
linkBuilder.androidParameters = DynamicLinkAndroidParameters(packageName: appBundleID)
linkBuilder.androidParameters?.minimumVersion = 0
linkBuilder.socialMetaTagParameters = DynamicLinkSocialMetaTagParameters()
linkBuilder.socialMetaTagParameters!.title = "Testing "
linkBuilder.socialMetaTagParameters!.descriptionText = "Invite You"
guard let longDynamicLink = linkBuilder.url else {
print("ERROR in linkBuilder")
return
}
DynamicLinkComponents.shortenURL(longDynamicLink, options: nil) { url, warnings, error in
if let error = error {
print("error shortening link: \(error.localizedDescription)")
return
}
if let url = url {
print("Share Url = ",url)
return
}
}
}
}
Firebase Dynamic Links not working Every Time Open Custom WebView (Redirection issue) Swift
Please check above code and let me know if i'm doing wrong anything, please correct me.
Can someone please explain to me how to show popup or deep working as expected in the Facebook case in the iOS 15., I've tried to with above code but no results yet.
Any help would be greatly appreciated.
Thanks in advance.

Is FB App Review necessary for read only website?

I'm creating a website which show a single Facebook page content in the homepage (events basic informations, photos and the five latest instagram photos). Do I have to submit an App Review? If yes, what permissions do I need?
There is no FB login request in the site and no content is published using it. No FB/Instagram user information is shown.
Thanks,
Alessio
EDIT:
Here is my code. It's the same for every endpoint
function loadFacebookEvents(){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
fbEvents=JSON.parse(this.responseText).data;
renderFacebookEvents()
//loadFacebookPhotos()
}
};
//events
xhttp.open("GET", "https://graph.facebook.com/thecagelivorno/events?time_filter=upcoming&fields=cover,description,end_time,name,start_time,ticket_uri,place&access_token=<my-access-token>", true);
xhttp.send();
}

get user images twitter | angular.js | firebase

im quite new to angular.js and firebase, so im starting to edit some code from an open source script to expens my knowledge ... i used a chat script with a facebook login.
i decided to go change the facebook login to a twitter login. (firebase lets you use logins pretty easy)
function onLoginButtonClicked() {
auth.login("Twitter");
}
the code also automaticly gets the user image from facebook with
<div id="comments">
<script id="template" type="text/template">
<img class="pic" src="https://graph.facebook.com/{{userid}}/picture">
<span><b>{{name}}</b><br/>{{body}}</span>
</script>
But now i changed it to an twitter app i wonder how i can get the twitter user icons instead?
--edit--
whats wrong with the question?
If you check out the user info returned from the login process, you'll see that it contains a an object called thirdPartyUserData. It contains all of the information provided by twitter during login; this is their purview and could change when their API or policies change in the future, but has (for as long as I've been familiar with the Twitter API) contained URLs for user's avatars:
var ref = new Firebase(URL);
var auth = new FirebaseSimpleLogin(ref, function(err, user) {
if( err ) console.error(err);
console.log('avatar is ', user && user.thirdPartyData.profile_image_url);
});
$('button').click(function() {
console.log('clicked it');
auth.login('twitter');
});
(Side note: the login provider is twitter vs Twitter)
There is another way to get the Twitter avatar which works better since getting it from the login user object is only for the logged in user and so would require that the URLs be saved which would then be a problem if the user ever changed their twitter avatar since the URL would then be missing. After some searching around I found that the twitter avatar (or facebook) avatar can be reached from the firebase user id as follows:
var info = userId.split(':');
var provider = info[0];
var id = info[1];
if ( provider === 'facebook' ) {
return 'https://graph.facebook.com/' + id + '/picture?type=square';
} else if ( provider === 'twitter' ) {
return 'http://twitter.com/api/users/profile_image/' + id + '?size=normal';
}

I cannot access other's facebook page insights though i connected through login pop up

i have create Facebook app for my external website and i created an Access token for that app with the "offline" access Permission (access token) with that token, i placed the Login button in my site ,i'm trying to fetch the insights data's,of those who log in through my External website with Facebook while connect i'm passing the offline_access, Manage_page **read_insights** permission, though permission granted by the page Admins i'm difficult to fetch the insights datas.Please some one help me to figure this
aspx file
<fb:login-button scope="manage_pages,offline_access,read_insights" size="large" style="opacity:.01 !important; width:250px !important;line-height: 31px !important;margin-top:0 !important;" onlogin="getPages()"> Sign In With Facebook Account </fb:login-button></div>
scrpit file
window.getPages = function () {
loadingImage($('#divSettings'), true, ($('.divSettings').outerHeight() - 50) + 'px');
//test
FB.getLoginStatus(function (response) {
if (response.status.toString().indexOf("connected") > -1) {
//User is conected and granded perms Good to go!
// alert('1');
FB.api('/me/accounts', function (resp) {
//var txtpageid = document.getElementById('ctl00_contentPlaceHolderRight_txtFBPageID').value;
var txtpageid = $.trim($('#ctl00_contentPlaceHolderRight_txtFBPageID').val());
// alert(2);
$('#spnFBsignMo').removeClass('Dsh_pop_MessTxt Pop_Facebk_Txt_error').addClass('Dsh_pop_MessTxt Pop_Facebk_Txt');
// if (response.error && response.error.type == "OAuthException") { alert('OAuth2.0 Exception Access token Expired or AppID miss matched'+'<br>'+'please contact Admin'); }
if (txtpageid != '') {
FBactualID = '';
for (var i = 0, l = resp.data.length; i < l; i++) {
var page = resp.data[i];
if (page.id == txtpageid) {
FBactualID = txtpageid;
varFBResponseFlag = true;
//alert('inside the page id validation');
}
}
}
getCheckedValue(FBactualID);
// alert('3');
});
}
else {
//measures to take the users to login again
// alert('You must login to Facebook to Validate the Page ID');
$('#spnFBsignMo').removeClass('Dsh_pop_MessTxt Pop_Facebk_Txt').addClass('Dsh_pop_MessTxt Pop_Facebk_Txt_error'); //DSh_Input_cus DSh_Input_width
loadingImage($('#divSettings'), false, ($('.divSettings').outerHeight() - 50) + 'px');
alert(4);
}
}); // login sta
i'm just give a call to with my access token to fetch information
something like this
https://graph.facebook.com/246355928767490/insights/page_views&access_token=xxxxxx-xxx-xx&since=2011-12-25&untill=2012-01-04
The call to
https://graph.facebook.com/app_id/insights
Will only give you access to insights about your app, not "other's facebook page insights". If you are actually trying to get your own insights, check first that there is any data by going to the insights page and looking at your specific application here:
http://www.facebook.com/insights/
If you are trying to get the visiting, logged in user's Insight stats for pages they own, there are already a number of answers to this. You will need to troubleshoot whether your user is indeed logged in or not but the function you are using to retrieve insights should be right. Have a look at theses previous answers:
Facebook page insights via API
Facebook Insights for Page via the API

apprequest dialog from facebook action script 3 sdk

I am writing an application for Android with Adobe AIR + using facebook action script 3 SDK.
Can I show standart apprequest dialog to user on Android phone?
FB.ui({method: 'apprequests', message: 'You should learn more about this awesome game.', data: 'tracking information for the user'});
How can I call it from facebook action script 3 SDK? Thanx!
take a look of this script, that answer you question
How can I call it from facebook action script 3 SDK?
private function inviteFriends():void
{
var dat:Object = new Object();
dat.message = "Let's invite friends for our Super Extra Max Facebook App, more info go to http://blog.ukasz.com";
dat.title = 'Super Extra Max Facebook App';
// filtering for non app users only
dat.filters = ['app_non_users'];
//You can use these two options for diasplaying friends invitation window 'iframe' 'popup'
Facebook.ui('apprequests', dat, onUICallback, 'popup');
}
and this is the handler
private function onUICallback(result:Object):void{
if(result == null){
trace('User closed the pop up window without inviting any friends');
return
}
var invitedUsers:Array = new Array();
invitedUsers = result.request_ids as Array;
trace('You Have Invited ', invitedUsers.length,' friends');
//Simple if else if you want user to invite certain amount of friends
if(invitedUsers.length > 1){
trace('GREAT, USER IS GENERATING TRAFFIC');
}else{
trace('No Good, User invited only one friend.');
}
}
Thanks to Lucas

Categories