Identity API fail with useNetlifyIdentity

Hi,
While using useNetlifyIdentity with the api string given on site I get the error:
Error: invalid netlify instance URL: undefined. Please check the docs for proper usage or file an issue.
const identity = useNetlifyIdentity(“https://ashopy.netlify.app/.netlify/identity”)

Thanks for helping

Hey @voyager1302 :wave:t2:

Welcome to The Community :slight_smile:

For clarification, which package / interface are you using that’s providing you with the useNetlifyIdentity hook?


Jon

I’m checking the identity following Jason Lengstorf and Shawn Wang clip with a simple Gatsby site using:
“dependencies”: {
@reach/dialog”: “^0.12.1”,
@reach/tabs”: “^0.12.1”,
@reach/visually-hidden”: “^0.12.0”,
“gatsby”: “^2.26.1”,
“gatsby-image”: “^2.5.0”,
“gatsby-plugin-manifest”: “^2.6.1”,
“gatsby-plugin-netlify-identity”: “^0.0.3”,
“gatsby-plugin-offline”: “^3.4.0”,
“gatsby-plugin-react-helmet”: “^3.4.0”,
“gatsby-plugin-sharp”: “^2.8.0”,
“gatsby-source-filesystem”: “^2.5.0”,
“gatsby-transformer-sharp”: “^2.6.0”,
“prop-types”: “^15.7.2”,
“react”: “^16.12.0”,
“react-dom”: “^16.12.0”,
“react-helmet”: “^6.1.0”,
“react-netlify-identity”: “^0.2.5”,
“react-netlify-identity-widget”: “^0.2.7”
},

Thanks! Just wanted to make sure I was referencing the right package. Instead of

const identity = useNetlifyIdentity(“https://ashopy.netlify.app/.netlify/identity”)

try using

const identity = useNetlifyIdentity(“https://ashopy.netlify.app/”)

And see if that does it :slight_smile:


Jon

Thanks. but that was the first thing i tried. and now again :slight_smile: and get
" Error: invalid netlify instance URL: undefined. Please check the docs for proper usage or file an issue. "
should I delete the site and install it again ?

Thanks.

I left the useNetlifyIdentity and used
const identity = useIdentityContext()
and all is working OK
Thanks .

Thank you for sharing the solution you discovered, @voyager1302. That is very helpful and other searching here for solutions to similar issues will likely appreciate it as well. :+1: