Skip to content

Instantly share code, notes, and snippets.

@aaronksaunders
Created May 8, 2013 21:54
Show Gist options
  • Save aaronksaunders/5543970 to your computer and use it in GitHub Desktop.
Save aaronksaunders/5543970 to your computer and use it in GitHub Desktop.
UPDATED FIX AVAILABLE HERE: http://bit.ly/1oaipIo Trying to create and link a facebook user to parse using appcelerator titanium. This solution listed below works BUT the question was removed from the Parse QA forum because I am using an undocumented method from an open source javascript library... don't quite understand that, but I am looking f…
// setting auth data retrieved from Ti.Facebook login
authData = {
"facebook" : {
"id" : Ti.Facebook.uid,
"access_token" : Ti.Facebook.accessToken,
"expiration_date" : expDate, // "format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
}
};
// Either way I resolved the problem, calling _handleSaveResult(true) on the returned user object,
// I just dont think it should have been as difficult as it was
// attempt to log the user in using the FB information
var user = new Parse.User();
user.save({
"authData" : authData
}).then(function(_user) {
// force the user to become current
_user._handleSaveResult(true); //<-- this is the evil method I called
if (!_user.existed()) {
// add additional user information
var userInfo = {
"acct_email" : "[email protected]",
"acct_fname" : "Bryce",
"acct_lname" : "Saunders"
};
return _user.save(userInfo);
}
}).then(function(_user) {
alert('Hooray! Let them use the app now.');
}, function(error) {
alert(' ERROR: ' + JSON.stringify(error, null, 2));
});
@aaronksaunders
Copy link
Author

@shodanuk
Copy link

Hi Aaron,

I've seen the thread on Parse's forums and seen a related post of yours on Titanium Q&A and wondered if you ever got any further with Parse? We're look at transitioning our current solution from ACS to Parse and logging in with FB is a critical feature for us.

Cheers,
Terry

@aaronksaunders
Copy link
Author

fix available here: http://bit.ly/1oaipIo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment