
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
react-facebook-auth
Advanced tools
Allows developers to receive a facebook authentication token that can be used by a backend service.
To install the latest version:
npm install --save react-facebook-auth
or
yarn add react-facebook-auth
import React from 'react';
import ReactDOM from 'react-dom';
import FacebookAuth from 'react-facebook-auth';
const MyFacebookButton = ({ onClick }) => (
<button onClick={onClick}>
Login with facebook
</button>
);
const authenticate = (response) => {
console.log(response);
// Api call to server so we can validate the token
};
const App = () => (
<div>
<h1>Facebook Auth</h1>
<FacebookAuth
appId="<app-id>"
callback={authenticate}
component={MyFacebookButton}
/>
</div>
);
ReactDOM.render(
<App />,
document.getElementById('root'),
);
A full example can be found in examples directory.
Params | Type | Info |
---|---|---|
appId | string | Facebook application id. Check https://developers.facebook.com |
scope | string | Comma separated list of extended permissions |
fields | string | name,email,picture |
callback | function | Callback triggered when we receive a response from facebook. |
onFailure | function | If provided, will be triggered on failed requests. |
returnScopes | boolean | When true, the granted scopes will be returned in a comma-separated list in the grantedScopes field of the authResponse |
autoLoad | boolean | Defaults to: false |
xfbml | boolean | Defaults to: false |
cookie | boolean | Defaults to: false |
reAuthenticate | boolean | Asks the person to re-authenticate unconditionally. Defaults to: false |
reRequest | boolean | Asks the person again for revoked permissions. Defaults to: false |
redirectUri | string | Defaults to: '/' |
version | string | Facebook SDK version. Defaults to: 2.8 |
language | string | Defaults to: en_US |
disableRedirect | boolean | Defaults to: false |
customProps | object | Allows custom props passing to the custom element. |
component | node | Custom react element that returns a button element. |
MIT
FAQs
A Component React for Facebook authentication
The npm package react-facebook-auth receives a total of 4,623 weekly downloads. As such, react-facebook-auth popularity was classified as popular.
We found that react-facebook-auth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.