Posted By

rlmcneary2 on 11/23/11


login javascript html facebook authorization

Versions (?)

Who likes this?

18 people have marked this snippet as a favorite


Facebook app login / authorization entirely client-side

 / Published in: JavaScript

A complete HTML page for a Facebook "app" that does login entirely on the client. 1 - Create a Facebook application (see Facebook developer docs.). 2 - Because of a Facebook "bug" the app should have Sandbox Mode disabled (App Settings - Advanced - Authentication). 3 - Uncomment the appropriate redirectUrl var. 4 - Update the appId and redirectUrl vars with your Facebook app values. 5 - Make the page available from a server.

Report this snippet  


RSS Icon Subscribe to comments
Posted By: thoaionline on November 23, 2011

lovely, i didn't know that this was possible

Posted By: slashyy77 on November 25, 2011

AWESOME!!! Thank you!

Posted By: guineacode on January 2, 2012

Registered an account to say thank you for giving credit for getting help from my example over at I appreciate it and I'm glad the article was helpful for you :)

Posted By: rookie on January 17, 2012

I started work on these applications. How can i get user info seperately to use in php code.. e.g. email, username, birthday etc.. seperately... thanks for your help

Posted By: rlmcneary2 on January 20, 2012

@guineacode - You're welcome! Since software development (like all human progress) is collaborative I believe that credit should be given where it's due.
@rookie - Since this is client-side code (all happening in the web browser) no requests are ever sent to a server for processing so no PHP code is invoked. It sounds like you're building a more traditional facebook app where the user is redirected after login to a URL on your server for processing. You should probably read the Server-side Flow section of Authentication. If you still have questions you should try Facebook's Stackoverflow site.

Posted By: rlmcneary2 on January 20, 2012

Updated so that the Facebook script loaded handler is hooked up before the script tag is inserted.
Noted that if your app is in sandbox mode login will not work correctly (it's how Facebook works or a bug depending on your point of view).
Added another redirect URL as an example of hot redirect a Facebook app compared to a website that uses Facebook login.

Posted By: antoreegan on September 25, 2012

can i call any javascript function after giving the permission to my application....

You need to login to post a comment.