Thursday, November 3, 2022

[FIXED] How to retrieve Facebook's user data from "developer Facebook"

Issue

I want to create a web app for educational purposes in which I required a search bar which helps me get Facebook's user data

For example: username, image

These two fields are enough for me.

Is it possible for me to retrieve such data using React.JS?


Solution

Here is the basic steps:

  • Create a facebook app and add facebook login to it.
  • Setup facebook login allowed SDK URls (where you will call the login method) and redirect URL after login.
  • Add needed permissions to your app
  • Add facebook SDK scripts to your react index.html or install the SDK.
  • Using the SDK call FB.login() and from the response save the user access token
  • send a request to FB_API_URL/me to get the user data you want

before all that test your requests to the created app with FB graph API Explorer https://developers.facebook.com/tools/explorer/

Last step: submit your app for review as most permissions will not work before this step.

useful links: https://developers.facebook.com/docs/graph-api/get-started https://developers.facebook.com/docs/facebook-login/web

enter image description here



Answered By - sh.e.salh
Answer Checked By - David Marino (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.