How to login into a React application using Facebook

Prem Das
2 min readAug 1, 2019

--

You can find my full source code in my github repo. https://github.com/premdas92/React-Facebook-Login

I am just assuming that you know how to set up a react app using create-react-app. So, I will move forward.

First of all we need to install an npm package . Open the command prompt and run the following command :

npm install — save react-facebook

This package contains many components. We can make use of it. Please refer the below link to read the whole document.

https://www.npmjs.com/package/react-facebook

First of all we will design a button which on click of which we want to log into the facebook. My UI looks like this.

On logging into Facebook, the UI looks like this.

Hitting the Facebook login will send a response which contains all the user data in the JSON form. We can filter the required data and store them in states and display them.

Please refer the below code.

Beautify your UI with CSS and its all done.

Thank you for reading this article.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Prem Das
Prem Das

No responses yet

Write a response