Created
October 27, 2009 08:14
-
-
Save mitchellh/219409 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
FB.Event.subscribe('auth.sessionChange', function(response) { | |
// The cookies we need to set for Facebooker, and the | |
// associated key into the Mu session object | |
var cookies = { | |
session_key: 'session_key', | |
user: 'uid', | |
expires: 'expires', | |
ss: 'secret' | |
}; | |
// If the session is not set, expire the cookies | |
var timestamp = response.session ? response.session.expires : 0; | |
// Set the Facebooker cookies. These cookies must be set | |
// with the format: APIKEY_NAME where NAME is one of the | |
// keys of the above cookies hash. | |
for (var cookie_name in cookies) { | |
var session_key = keys[cookie_name]; | |
var val = response.session ? response.session[session_key] : ''; | |
document.cookie = | |
FB._apiKey + '_' + cookie_name + '=' + val + | |
'; expires=' + new Date(timestamp * 1000).toGMTString() + | |
'; path=/'; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment