GithubHelp home page GithubHelp logo

gimral / doopage-react-facebook-login Goto Github PK

View Code? Open in Web Editor NEW

This project forked from huynhhuyhiep/doopage-react-facebook-login

0.0 0.0 0.0 2.68 MB

Library login facebook for ReactJs

TypeScript 73.55% Shell 0.55% HTML 21.03% CSS 4.87%

doopage-react-facebook-login's Introduction

@doopage/react-facebook-login

Support Login Facebook Component for ReactJS

NPM JavaScript Style Guide

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

doopage-react-facebook-login's People

Contributors

huynhhuyhiep avatar hiephuynh96 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.