First of all, you need to create a JavaScript SDK application with facebook ( please follow this link ). After creating the application, you will have an APP identifier. Then add the following code to app.js
Ext.application({ name: 'FBLogin', launch: function() { Ext.create('Ext.container.Viewport', { items:[ { xtype: 'panel', html: '<center><div id="fblogin" class="fb-login-button">Login with Facebook</div></center>' } ], listeners:{ render: function(obj, eOpts){ window.fbAsyncInit = Ext.bind(this.onFacebookInit, this); (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)); } }, onFacebookInit: function(){ console.log('onFacebookInit'); var me = this; FB.init({ appId : 'YOUR_APP_ID', status : true, xfbml : true }); FB.Event.subscribe('auth.authResponseChange', Ext.bind(me.onFacebookAuthResponseChange, me)); }, onFacebookAuthResponseChange: function(response){ this.down('panel').setVisible(false); alert("Success fully Logged in"); } }); } });
On a website called "SiteURL:", a website will be created under the name Facebook Login when creating Facebook APP. This must be specified in the URL of your web application. (for example: http://example.com )
source share