I'd like to sign users into my React-Native app using Parse and Facebook but it seems like the Facebook JS SDK is dependent on the dom. How can I sign in a user with facebook?
I'm currently using https://github.com/magus/react-native-facebook-login to log the user in natively, so I have access to their auth token, ect. But can't use the Parse.FacebookUtils.login() without the FB JS SDK.
If you have your authData from the native FB SDK, you can bypass the FacebookUtils.init() call entirely. This should log in to a Parse user with FB:
Parse.User._logInWith('facebook', {
authData: {
id: FB_USER_ID,
access_token: USER_ACCESS_TOKEN,
expiration_date: TOKEN_EXPIRATION_DATE
}
});
This'll return a Promise, same as Parse.FacebookUtils.logIn()
I managed to get around this by commenting out the references to FB in the Parse SDK Parse.FacebookUtils.logIn flow and removing the safety checks. The FB SDK isn't actually needed to authenticate a user with Parse if you already have the authData object.
Obviously not an ideal solution, so leaving this open
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With