Install Facebook Auth plugin
npm install react-facebook-login --save
import FacebookLogin from 'react-facebook-login';
<FacebookLogin
appId={you_app_id_in_fb}
autoLoad={true}
fields="name,email"
onClick={(d)=>{
/** **/
}}
callback={(d)=>{
let url = `http://api.directual.com/good/api/v4/auth/`
let body = { provider: "fb", token: d.accessToken, clientID: you_app_id_in_fb }
fetch(url, {
method: 'POST',
body: JSON.stringify(req.body),
headers: {
'Content-Type': 'application/json'
}
}).then(res2=>{
res2.json().then(result=>{
res.end(JSON.stringify(result))
}).catch((data)=>{
res.end('error')
})
})
}} />