 <p><a href="http://developers.facebook.com/docs/reference/javascript/FB.login/" rel="nofollow"><code>FB.login</code></a> and <code>FB.api</code> doesn't provide you success/failure reporting just like you trying to implement it. There is no second argument for callbacks...</p> <p><code>FB.login</code> callback get one and only argument:</p> <blockquote> <p>response from <a href="http://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/" rel="nofollow"><code>FB.getLoginStatus</code></a>, <a href="http://developers.facebook.com/docs/reference/javascript/FB.login/" rel="nofollow"><code>FB.login</code></a> or <a href="http://developers.facebook.com/docs/reference/javascript/FB.logout" rel="nofollow"><code>FB.logout</code></a>. This response object contains:</p> <p><strong>status</strong><br> The status of the User. One of connected, not_authorized or unknown.<br> <strong>authResponse</strong><br> The authResponse object.</p> </blockquote> <p><code>FB.api</code> callback get one and only arguments which is response from Graph API usually (but not always) containing <code>data</code> property, object fields, boolean false or <code>error</code> object (with <code>message</code>, <code>type</code> and <code>code</code> properties)</p> <hr> <p>You can modify your <code>loginHandler</code> by correction of response callbacks to take care of right arguments:</p> <pre><code>function loginHandler(loginResponse){ try{ if(loginResponse.authResponse){ alert('i am if'); FB.api('/me', function(response) { alert("first name == " + response.first_name + "\n ln === " + response.last_name); }); } }catch(error){} } </code></pre>