Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-Native: Facebook and Google Login

I am currently trying to implement Facebook and google login for a react-native app for ios and android. I must say, it is much less user-friendly than ionic for example. I have seen some libraries trying to implement this, but they all seem not to be maintained anymore. Is there any common, reliable and stable solution that is easy to implement (if not easy to implement, really any solution that will work), to implement Facebook and/or Google login for react-native apps?

like image 354
DaveTheAl Avatar asked Jun 15 '17 21:06

DaveTheAl


People also ask

How do I add Facebook and Google to login to React Native?

Go to the Firebase console. In the center of the project overview page, click the Android icon (plat_android) to launch the setup workflow. If you've already added an app to your Firebase project, click Add app to display the platform options. Enter your app's package name in the Android package name field.

How do you integrate social login in React Native?

Ensure the "Google" sign-in provider is enabled on the Firebase Console. import { GoogleSignin } from '@react-native-google-signin/google-signin'; GoogleSignin. configure({ webClientId: '', }); Once initialized, setup your application to trigger a sign-in request with Google using the signIn method.

Is Facebook still supporting React Native?

As of January 19, 2021, Facebook React Native SDK will no longer be officially supported by Facebook. Please visit our blog post for more information and Github for React Native going forward.


1 Answers

For Google Login:

I tried both https://github.com/devfd/react-native-google-signin and https://github.com/joonhocho/react-native-google-sign-in. And neither of them work properly! I'm doubted whether they're maintained anymore.

The final correct solution is https://github.com/fullstackreact/react-native-oauth. It has a very good installation guideline and worked very well for my project. It also supports auth with other providers like Facebook, Twitter, Slack, ...

Btw, for Facebook Login, https://github.com/facebook/react-native-fbsdk also works nicely, despite of complex installation.

like image 64
haotang Avatar answered Sep 18 '22 15:09

haotang