lunaceee / gotruejs-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GoTrue JS Examples

Hi there! This is my playground repo to test out Netlify’s GoTrue JS client library. You can see a live demo of the examples at link.

To run the examples locally, here’s what you’ll need:

System Requirements

Setup

git clone git@github.com:imorente/gotruejs-examples.git
cd gotruejs-examples.git
yarn

Running the examples

yarn start

Troubleshooting

If you want to run the examples against your own Identity instance, change the value of APIUrl in src/index.js to point to your own Netlify site URL.

After you do that, you might come across one of the following errors, like I did.

Error: Failed to load

Failed to load https://imorente-gotrue-examples.netlify.com/.netlify/identity/signup:
Response to preflight request doesn't pass access control check:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:8082' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

What this error can mean:

  • The URL in the APIUrl option is wrong. Solution: Look out for typos! APIUrl should look something like: https://{your-site-domain}/.netlify/identity
  • You haven’t enabled Identity in your Netlify site. Solution: Go to your Netlify dashboard and enable Identity for your site.

Error: Unable to locate site configuration

POST https://imorente-gotrue-examples.netlify.com/.netlify/identity/signup 404 ()
error :( Error: Unable to locate site configuration
  at main.js:1

What this error can mean:

  • Your Identity service hasn’t been detected yet. Solution: Trigger a new deploy from your Netlify dashboard (or push a change to your repository) to force a cache refresh in the Netlify origin server.

About


Languages

Language:HTML 64.4%Language:JavaScript 20.3%Language:CSS 15.3%