Facebook Login In React Native | Expo

React native is a hybrid mobile app development platform that enables you to use your application in android, ios as well as web. so code once and use it anywhere and In this article, we will configure how to make Facebook authentication in your react native application using Facebook Graph API with Expo.
"Expo is a framework and a platform for universal React applications. It is a set of tools and services built around React Native and native platforms that help you develop, build, deploy, and quickly iterate on iOS, Android, and web apps from the same JavaScript/TypeScript codebase."
Requirements
Expo account
Facebook developer account
Your Expo project setup
Step 1: Create an expo project
Create an expo project and install the expo-facebook library by following these command below:-
expo init Login_Social
cd Login_Social/
expo install expo-facebook
expo start
Step 2 Get Facebook kay hash - To get this you have to sign in to your expo account on your terminal or if not have to create a new one and type the command given below.
expo fetch:android: hashes
If you not have credentials type expo credentials: manager and follow mentioned below screenshot.
Step 3 Create an app on https://developers.facebook.com/ Once you get the hash key copy that one and create your Facebook developer account after that create a new application that you want to connect, fill in all necessary details about your application like name, package name icon, and follow mentioned below. and copy that hash key and Go to Settings => Basic = > Add Platform => Android or as you want.

Paste that hash key and save changes and copy AppID for your application code which you need for login initialization.
Step 4 Make changes to your navigation or files: just type and follow the code below to complete a login authentication using Facebook with the expo. after fetching the user's data it will return you response object (user profile).

So finally we configured Facebook login in react native using Expo you can get code repo in my GitHub the link below:-
https://github.com/ShivamNamdeo/facebook-login-expo
Comments
Post a Comment