npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-facebook-login-hook

v1.3.0

Published

React hook for 'Log in with Facebook' feature

Readme

react-facebook-login-hook

NPM version NPM downloads NPM bundle size

Description

react-facebook-login-hook provides a React hook for Facebook login.

  • TypeScript support
  • Lightweight - no external dependencies

Quickstart:

const { busy, logIn, logOut, getProfile } = useFacebookLogin({ appId: "YOUR_APP_ID" });

async function handleLogin() {
    const response = await logIn();
    if (response?.status === "connected") {
        // response.authResponse.accessToken - process access token
        const profile = await getProfile();
        console.log("profile", profile);
    }
}

return (
    <button disabled={busy} onClick={handleLogin}>
        {busy ? "Please wait..." : "Log in with Facebook"}
    </button>
);

API

| name | type | Description | | ---------- | ---------- | ----------------------------------------------------------------------------- | | ready | boolean | Indicates if Facebook SDK script was loaded successfully | | busy | boolean | Has a value of true when the hook waits for the login process to complete | | logIn | function | | | logOut | function | Log out Facebook user from your app | | getProfile | function | Get data from a Facebook user's profile. Can be called after successful login |

useFacebookLogin options/parameters

| name | type | Required | Default value | Description | | ------------- | -------------- | -------- | -------------------- | ----------------------------------------------------------------- | | appId | string | ✓ | | Your application ID | | scope | string | | public_profile,email | Facebook permissions | | fields | string | | name,email,picture | Facebook fields to fetch | | language | string | | en_US | SDK language | | useRedirect | boolean | | undefined | Use redirect flow | | onInitError | function | | undefined | Callback on init error (loading script element with Facebook SDK) | | sdkInitParams | InitParams | | undefined | Parameters for the SDK initialization | | loginOptions | LoginOptions | | undefined | Parameters for the Facebook login flow | | dialogParams | DialogParams | | undefined | Parameters for the Facebook login dialog |

InitParams (Facebook Documentation about init params)

| name | type | Required | Default value | Description | | -------------------- | --------- | -------- | ------------- | ------------------------------------------------------------------------------------------------------- | | version | string | | v16.0 | SDK version | | cookie | boolean | | undefined | Determines whether a cookie is created for the session or not | | localStorage | boolean | | true | Determines whether a long-lived access token for the session can be saved in localStorage | | xfbml | boolean | | undefined | Determines whether XFBML tags used by social plugins are parsed | | frictionlessRequests | boolean | | undefined | Frictionless Requests are available to games on Facebook.com or on mobile web using the JavaScript SDK. |

LoginOptions (Facebook Documentation about login options)

| name | type | Required | Default value | Description | | ----------------------- | --------- | -------- | ------------- | ----------------------------------------------------------------------------------------------------------------------- | | auth_type | string | | undefined | Supports 3 values: rerequest, reauthenticate, reauthorize | | return_scopes | boolean | | undefined | When true, the granted scopes will be returned in a comma-separated list in the grantedScopes field of the authResponse | | enable_profile_selector | boolean | | undefined | When true, prompt the user to grant permission for one or more Pages | | profile_selector_ids | string | | undefined | Comma separated list of IDs to display in the profile selector |

DialogParams (Facebook Documentation about dialog params)

| name | type | Required | Default value | Description | | ------------- | -------- | -------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | | redirect_uri | string | | undefined | The URL that you want to redirect the person logging in back to. This URL will capture the response from the Login Dialog | | state | string | | undefined | A string value created by your app to maintain state between the request and callback. This parameter should be used for preventing Cross-site Request Forgery. | | response_type | string | | undefined | Determines whether the response data included when the redirect back to the app occurs is in URL parameters or fragments |

Other resources