Logging my rails application's users into facebook through iframe display option hangs -
this code not work:
$(document).ready(function() { window.fbasyncinit = function() { fb.init({appid: "<%= facebook_config['application_id'] %>", status: true, cookie: true, xfbml: true}); fb.ui( { method: 'oauth', client_id: "<%= facebook_config['application_id'] %>", scope: "<%= facebook_config['permissions'] %>", state: "<%= secure_hash(facebook_config['secret_phrase']) %>" }, function(response) { if (response && response.post_id) { alert('post published.'); } else { alert('post not published.'); } } ); });
what doing wrong?
you've done fb.init({appid: ..., xfbml: true}); bit first right?
i think method want call {method: 'oauth'} like:
fb.ui({ method: 'oauth', client_id: <%= facebook_config['application_id'] %>, scope: '<%= facebook_config['permissions'] %>', state: '<%= secure_hash(facebook_config['secret_phrase']) %>' }, function (response) { if (response && response.post_id) { alert('success'); } else { alert('failure'); } } );
although, login it's easier call:
fb.getloginstatus(function(response) { if (response.session) { alert('success'); } else { alert('nope'); } });
Comments
Post a Comment