Facebook application only accessible by admin user account - facebook

I created a facebook app to share articles from a website. When I'm connected from the app's admin account, I can share articles, but when I try to share articles from another account, this error is displayed: An error has occurred, please try again later
This is the used script:
<script>
window.fbAsyncInit = function() {
FB.init({appId: '1488318304714792', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root_single_post').appendChild(e);
}());
$(document).ready(function(){
$('.share_button_single_post').click(function(e){
e.preventDefault();
FB.ui(
{
method: 'feed',
name: '<?php echo utf8_encode(strtoupper($chaine2)); ?>',
link: $("input[type='hidden'][name='"+this.id+"1']").val(),
picture: 'http://www.bdo.com.tn/BDO-facebook-logo.png',
caption: 'www.bdo.com.tn',
description: $("input[type='hidden'][name='"+this.id+"2']").val()+'...',
message: ''
});
});
});
</script>

You'll need to check you're not in sandbox mode first.
Have you gone to "Status and Review" in the option panel on the left, and then clicked "yes" for the question "Do you want to make this app and all its live features available to the general public?"
This should make the app accessible to all FB users.

Related

How can I change Facebook "Like" button (or perform "Like" action via API)?

Facebook has a great plug-and-play "Like" button, which I am using to let a user "Like" my company's official FB page (not an OpenGraph object or something on my company's web site, but http://facebook.com/MyCompanysFacebookPage).
This all works fine, but the "Like" button itself is quite small, so I'd like to replace it with a different graphic. Is this possible? And-- if not-- is it possible to do this "Like" action via the API? (It's fine if I have to ask the user for some kind of special permissions to perform this task, since I am already asking them for other permissions earlier in the UX flow). Thank you.
if its just a standard "like" button something like this?
http://jsfiddle.net/c7rAN/
(it will give you a error until you fill in the fields properly.)
html:
<div id="fb-root"></div>
<img src = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSsRdeyOrORG3mjpsal3tMEzG3hzIl6zkfNnTKm61hJ_h3TL3OQ" id = "share_button">
jquery/js
window.fbAsyncInit = function() {
FB.init({appId: 'vvv', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
$(document).ready(function(){
$('#share_button').click(function(e){
e.preventDefault();
FB.ui(
{
method: 'feed',
name: 'nameit',
link: 'linkit',
picture: 'logo or whatever',
caption: 'caption',
description: 'desscription',
message: 'whatever'
});
});
});

Fb.ui post to wall

I am using the code below just as from https://developers.facebook.com/docs/reference/dialogs/feed/ to post to a users wall. However the post does not appear on the wall. Is there something I'm missing?
FB.ui({
method: 'feed',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with people.'
}, function(response){});
I have the Javascript SDK connect.facebook.net/en_US/all.js loaded. Do I have to add the following code?
FB.init({
appId: 'xxxXXxxx',
status: true,
cookie: true,
xfbml: true
});
There are many reasons why it might not work. The information you provided is really not sufficient, so I'm just gonna go ahead and list a couple of reasons why it might not work:
make sure you created an application on [Facebook developers] (https://developers.facebook.com/apps/), and have the Site URL correct along with the App Domains
the "xxxXXxxx" in the FB.init() is the application ID generated while creating an app on Facebook.
If you're trying on localhost, it will never work.
Finally, your code should look something like this:
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : 'xxxXXXxxx', // App ID
channelURL : '../../Vendor/channel.php', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
oauth : true, // enable OAuth 2.0
xfbml : true // parse XFBML
});
function postFeed(){
FB.ui({method: 'feed',
picture: 'https://www.example.com/img/fb-post.jpg',
link: "http://www.example.com/",
caption: "example.com",
description: "a small description associated with your post",
}, requestCallback);
}
// Load the SDK Asynchronously
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol
+ '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>

wall post on facebook from hybrid mobile application

I am having a hybrid mobile application(should work in android and ios). In which I need to post on facebook wall from my application. Please note its a hybrib app, so I am not supposed to use any java or c code.
I tried the following method , its working in simulator , but not in actual device. Please help me.
<script>
window.fbAsyncInit = function() {
FB.init({
appId : ' my appID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#share_button').live('click', function(e){
e.preventDefault();
FB.ui(
{
method: 'feed',
name: 'HyperArts Blog',
link: 'http://hyperarts.com/blog',
picture: 'http://www.hyperarts.com/_img/TabPress-LOGO-Home.png',
caption: 'I love HyperArts tutorials',
description: 'The HyperArts Blog provides tutorials for all things Facebook',
message: ''
});
});
});
</script>
Thanks
I ran into this. your:
document.location.protocol
which is suppose to pull in the FB SDK is actually "file:///" and thats what gets fed into the url for that FB JS library.
Manually specify http:// or https://
This didnt work for me either on safari webView on IOS so i had to hit the endpoints manually using AJAX.

Problem with the redirections of apprequest in php

I am using the code below to send an app request to someone.
It works fine; it displays in Facebook notification.
when I click that notification, it redirects to the facebook app page.
I'm unable to make it redirect to the page which exists list of facbook app requests.
How do I make it redirect there?
is there any need to do changes in my facebook app setting ?
<div id="fb-root"></div>
<script>
function FacebookIframeAuthenticator(){
window.fbAsyncInit = function() {
FB.init({
appId: '123456789',
status: true,
logging: false,
cookie: false,
xfbml: true
});
FB.Canvas.setSize({height: 2000});
FB.Canvas.scrollTo(0,0);
FB.Canvas.setAutoResize();
};
var e = document.createElement('script');
e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}
new FacebookIframeAuthenticator();
function sendInvReq ( friendUid, event ){
FB.ui({
method: 'apprequests',
message: 'I\'d like you to join my professional network on SITE NAME .- DB',
to: friendUid,
data: ''
}
, function(r){
if (r != null && typeof(r) != 'undefined'){
if (r.request_ids){
FB.api('/me/apprequests/?request_ids='+toString(request_ids));
$.ajax({
url: 'http://exapmple.com',
cache:false,
type:'POST',
data:({requestIds: r.request_ids.join(','), x_csrf: csrf}),
dataType: 'json',
complete: function(transport){}
});
}
}
}
);
}
</script>
in your developers page (https://developers.facebook.com/apps/your_app_id/advanced) you must change your application advanced settings "Upgrade to Requests 2.0" to disable
If I understood your question right: you can't control the notification url. It will always automatically redirect to your app url with one or more request_ids as paramter. The only possibility to redirect to your prefered destination is to look for this parameter and react properly.

integrated facebook facepile need

I am working on project, it needs facepile (plugin of facebook) in index page,
how can I do it?
you need to get an appID from facebook developers site. (http://developers.facebook.com/setup/)
then..
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: 'YOUR APP ID HERE', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
THEN...
place this into your page:
<fb:friendpile width="210"></fb:friendpile>
or whatever feature you need.
try this link for more: http://developers.facebook.com/docs/reference/javascript/
Is this showing the Facepile of a page or the user himself (me)?
I tried your code but it always shows a login frame also if I'm already logged in to Facebook.
My target is to have a list of Fans and posts of a specific page for my website.