I want to ask a user to grant the "publish_stream" permission to my app with the facebook javascript sdk.
I initialize it like this:
FB.init({
appId : '203702512703',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
channelURL : 'http://mydomain.com/channel.php', // channel.html file
oauth : true // enable OAuth 2.0
});
And my FB.ui call looks like this:
FB.ui({
client_id: '203702512703',
method: 'oauth',
scope: 'publish_stream',
redirect_uri: 'http://mydomain.com/',
response_type: 'token',
display: 'dialog'
});
If i change 'dialog' to 'popup' it works perfectly. But if i specify 'dialog' or leave the option out it shows me the fb-div but with a loading animation (like this: http://p.iqs.me/t1c4j ) and the content never loads.
What am i doing wrong?
UPDATE: I found this page http://developers.facebook.com/docs/reference/dialogs/#display that says the following about using "iframe" as display: "Because of the risk of clickjacking, this is only allowed for some certain dialogs, and requires you to pass a valid access_token"
Doesn't say anything like that about "dialog" thought but both iframe and dialog gives the same bad result.
How would i pass in the access_token?
'popup' is mandatory for method: 'oauth' or FB.login for javascript SDK because of security (clickjacking and phishing). I'd suggest to use FB.login anyway to get permissions or to authenticate because it is more convenient.
hope this helps