Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
gatsby-plugin-netlify-identity-gotrue
Advanced tools
A Gatsby-layer around react-netlify-identity-gotrue for pure React Netlify Identity / GoTrue bindings
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 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.
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
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.
FAQs
A Gatsby-layer around react-netlify-identity-gotrue for pure React Netlify Identity / GoTrue bindings
The npm package gatsby-plugin-netlify-identity-gotrue receives a total of 29 weekly downloads. As such, gatsby-plugin-netlify-identity-gotrue popularity was classified as not popular.
We found that gatsby-plugin-netlify-identity-gotrue 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.