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 🙏

© 2024 – Pkg Stats / Ryan Hefner

gatsby-plugin-netlify-identity-gotrue

v0.3.5

Published

A Gatsby-layer around react-netlify-identity-gotrue for pure React Netlify Identity / GoTrue bindings

Downloads

76

Readme

gatsby-plugin-netlify-identity-gotrue

See the demo! ✨ https://gatsby-identity-demo.jonsully.net ✨

See the demo code 🤖 here! 🤖


A simple Gatsby plugin for enabling a comprehensive and fully-featured Netlify Identity implementation into your Gatsby site. This plugin is a simplistic wrapper around react-netlify-identity-gotrue. See that repository for the full API documentation available within Gatsby.

NPM

Install

npm i gatsby-plugin-netlify-identity-gotrue
# or
yarn add gatsby-plugin-netlify-identity-gotrue

Then, in gatsby-config.js, add an entry to plugins:

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-plugin-netlify-identity-gotrue`,
      options: {
        url: `https://your-unique-site.netlify.app` // ❗REQUIRED❗
        // Do _not_ include any path (/.netlify/identity, etc.) and
        // leave the trailing slash off.
      }
    }
  ]
}

PLEASE NOTE - This plugin will fail if Netlify Identity isn't enabled for your live Netlify site. Local development uses the same Netlify Identity instance as your live / 'prod' site.

Usage

Once you've installed the plugin into your Gatsby site and added the plugin options to your gatsby-config.js file, you can pull in the useIdentityContext hook anywhere in your site. Just add import { useIdentityContext } from 'react-netlify-identity-gotrue' to your file's import statements (NOTE: this plugin pulls in react-netlify-identity-gotrue so the import should work just fine and you don't need to manually install react-netlify-identity-gotrue) then anywhere you need it, call the hook: const identity = useIdentityContext()

In context, this looks like:

// my-account.js
import React from 'react'
import { useIdentityContext } from 'react-netlify-identity-gotrue'

export default () => {
  const identity = useIdentityContext()
  
  return {
    identity.user
      ? <p>Welcome to your account, {identity.user.email}</p>
      : <p>Please log in</p>
  }
}

To learn more about the identity object and the full API available to you when using this plugin, please see react-netlify-identity-gotrue.

To see a fully working, implemented demo using this plugin (for ideas or in-context references), please see gatsby-plugin-netlify-identity-gotrue-demo


Note ❗

This repository, the underlying react-netlify-identity-gotrue repository, and the gatsby-plugin-netlify-identity-gotrue-demo repository that consumes this one are not related to Netlify's netlify-identity-widget stack or @sw-yx's react-netlify-identity stack, both of which ultimately sit on gotrue-js. This stack is written in pure React and interfaces with Netlify Identity directly without any dependencies. You can read some history about the three stacks here: https://jonsully.net/blog/announcing-react-netlify-identity-gotrue.