0.0.7 • Published 3 years ago
@doopage/react-facebook-login v0.0.7
@doopage/react-facebook-login
Support Login Facebook Component for ReactJS
For more related information such as appId, see https://developers.facebook.com/docs/facebook-login/web/
Install
npm install --save @doopage/react-facebook-login
or
yarn add @doopage/react-facebook-login
Usage
import FacebookLogin from '@doopage/react-facebook-login'
import { Button } from "@doopage/react-ui-kit";
const Example = () => {
const responseFacebook = (response) => {
console.log("responseFacebook", response);
// do something
}
return (
<FacebookLogin
appId={'YOUR_FB_APP_ID'}
callback={responseFacebook}
fields="name,email,picture"
scope="public_profile,email,pages_messaging_subscriptions"
>
{({ onClick, disabled }) => {
return (
<Button
color="info"
onClick={onClick}
disabled={disabled}
>
Đăng nhập Facebook
</Button>
);
}}
</FacebookLogin>)
}
Props
params | required | type | default | description |
---|---|---|---|---|
appId | x | string | process.env.FACEBOOK_APP_ID | Facebook app id |
scope | string | public_profile,email | public_profile, email, user_birthday | |
fields | string | name | ||
callback | x | function | resultFacebookLogin | |
returnScopes | boolean | true | ||
xfbml | boolean | false | ||
cookie | boolean | false | ||
redirectUri | string | window.location.href | ||
language | string | en_US | ||
isMobile | boolean | detected via userAgent | use isMobile of isreact-device-detect to detect | |
disableMobileRedirect | boolean | true | set to true for popup authentication on mobile devices | |
onFailure | function | optional function to separatere the failed init | ||
state | string | optional string to maintain state between the request and callback. This parameter should be used for preventing Cross-site Request Forgery and will be passed back to you, unchanged, in your redirect URI, default is facebookdirect | ||
authType | string | optional string to change authentication type | ||
responseType | string | optional string to change response type. Default value is 'code' | ||
version | string | Graph API version, default is 9.0 |
License
MIT © Huynh Huy Hiep