Last active
August 29, 2015 14:03
-
-
Save connortreacy/6dc7ea54a6673775d78d to your computer and use it in GitHub Desktop.
Getting a Parse.User for an authenticated Facebook user.
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
function authenticateParseUser(authResponse) { | |
Parse.FacebookUtils.logIn({ | |
id: authResponse.userID, | |
access_token: authResponse.accessToken, | |
expiration_date: moment().add('s', authResponse.expiresIn).format() | |
}).then(function(user){ | |
/* Do useful stuff with your new Parse.User */ | |
}, function(error){ | |
/* Something went wrong with the authentication */ | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that I'm using moment.js to convert from an
expiresIn
timestamp to a Parse compatible date format.