Last active
November 20, 2016 14:25
-
-
Save StabbyMcDuck/1f8be22e1398f0c54b54c689b5698682 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery -> | |
$('body').prepend('<div id="fb-root"></div>') | |
$.ajax | |
url: "#{window.location.protocol}//connect.facebook.net/en_US/all.js" | |
dataType: 'script' | |
cache: true | |
window.fbAsyncInit = -> | |
FB.init(appId: 'YOUR_FACEBOOK_APP_ID', cookie: true) | |
$('#facebook_sign_in').click (e) -> | |
e.preventDefault() | |
FB.login (response) -> | |
console.log('FB.login called') | |
window.location = '/auth/facebook/callback' if response.authResponse | |
$('#sign_out').click (e) -> | |
FB.getLoginStatus (response) -> | |
FB.logout() if response.authResponse | |
true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment