I am trying to use the JavaScript SDK inside a page tab app (for the purpose of sharing and what-not).
I'm calling FB.login after FB.init but I'm getting this error in the pop-up: "An error occurred. Please try again later."
This happens both in development and when I deploy to Heroku (this is a Rails 3 app).
You can see a sample/demo here , but here's the relevant code:
<body>
<div id='fb-root'></div>
<div id='welcome_header'>
<h1>Coupons</h1>
</div>
<h2>Sorry, no active coupons at this time.</h2>
<h3>
Sign up to receive future coupons from
Ed's Coffee & Deli
</h3>
<div id='form_section'>
<form accept-charset="UTF-8" action="/fb/1/subscribers" class="new_subscriber" data-remote="true" id="new_subscriber" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="W3tWnguGrIMRJVXh23K6jTxmOH+QbeJZSD5CUnGf7bg=" /></div>
<input id="subscriber_email" name="subscriber[email]" placeholder="enter email" size="30" type="text" />
<input class="btn small btn-primary" name="commit" type="submit" value="GO" />
</form>
</div>
<script>
//<![CDATA[
window.fbAsyncInit = function() {
FB.init({
appId : '179754758810880', // App ID
channelUrl : '//localhost:5000/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
oauth : true // parse XFBML
});
// Login
FB.login(
function(response) {
console.log(response);
},
{ scope: 'publish_actions' }
);
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
//]]>
</script>
</body>
Any idea why this is happening? Can the JS SDK be used inside a page tab?
Don't like to answer my own questions, but I was able to figure this out.
In the app settings, I didn't have "Website" checked under the integration options. I assumed because it was setup as a page tab, that wasn't necessary. But it is.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.