Git Product home page Git Product logo

react-netlify-identity's Introduction

SEEKING MAINTAINERS

i've left Netlify. obviously i still care about netlify but im gonna have other stuff to do and wont be able to give this my full attention. pls open an issue if you use this and want to take over. post your npm username too. i'd love to find a good home for this project.


react-netlify-identity

Netlify Identity + React Hooks, with Typescript. Bring your own UI!

NPM JavaScript Style Guide

Use Netlify Identity easier with React! This is a thin wrapper over the gotrue-js library for easily accessing Netlify Identity functionality in your app, with React Context and Hooks. Types are provided.

Three demos:

This library is not officially maintained by Netlify. This is written by swyx for his own use (and others with like minds ๐Ÿ˜Ž) and will be maintained as a personal project unless formally adopted by Netlify. See below for official alternatives.

Blogposts

List of Alternatives

Lowest level JS Library: If you want to use the official Javascript bindings to GoTrue, Netlify's underlying Identity service written in Go, use https://github.com/netlify/gotrue-js

React bindings: If you want a thin wrapper over Gotrue-js for React, react-netlify-identity is a "headless" library, meaning there is no UI exported and you will write your own UI to work with the authentication. https://github.com/sw-yx/react-netlify-identity. If you want a drop-in UI, there is yet another library that wraps react-netlify-identity: https://github.com/sw-yx/react-netlify-identity-widget

High level overlay: If you want a "widget" overlay that gives you a nice UI out of the box, with a somewhat larger bundle, check https://github.com/netlify/netlify-identity-widget

High level popup: If you want a popup window approach also with a nice UI out of the box, and don't mind the popup flow, check https://github.com/netlify/netlify-auth-providers

Typescript

Library is written in Typescript. File an issue if you find any problems.

Install

yarn add react-netlify-identity

Usage

โš ๏ธ Important: You will need to have an active Netlify site running with Netlify Identity turned on. Click here for instructions to get started/double check that it is on. We will need your site's url (e.g. https://mysite.netlify.com) to initialize IdentityContextProvider.

When you call useIdentityContext(), you can destructure these variables and methods:

  • user: User
  • setUser: directly set the user object. Not advised; use carefully!! mostly you should use the methods below
  • isConfirmedUser: boolean: if they have confirmed their email
  • isLoggedIn: boolean: if the user is logged in
  • signupUser(email: string, password: string, data: Object, directLogin: boolean = true)
    • directLogin will internally set state to the newly created user
    • isConfirmedUser will be false
    • isLoggedIn will be true
    • setting directLogin to false won't trigger the state
  • loginUser(email: string, password: string, remember: boolean = true) - we default the remember term to true since you'll usually want to remember the session in localStorage. set it to false if you need to
  • logoutUser()
  • requestPasswordRecovery(email: string)
  • updateUser(fields: object): see updateUser @ gotrue-js
  • getFreshJWT()
  • authedFetch(endpoint: string, obj: RequestInit = {}) a thin axios-like wrapper over fetch that has the user's JWT attached, for convenience pinging Netlify Functions with Netlify Identity
  • recoverAccount(remember?: boolean): verifies and consumes the recovery token caught by runRoutes, sets user on success
  • param: TokenParam
    • a token exposing Netlify tokens a dev has to implement the actions for; namely invite, recovery, email_change and access_denied
    • important: tokens this package exposes no methods for are automatically handled and will not be passed down - see runRoutes implementation
    • if you don't want this behaviour (added here in v.0.1.8), pass runRoutes={false} to the exposed hook
    • for further reference, please check the type definition
    • an example implementation for a Recovery process can be found below
  • verifyToken()
    • consumes & verifies TokenParam based on the type and tries to retrieve a valid user object
    • devs duty to show password field to afterwards call signupUser(user.email, newPassword)
import React from 'react';

import { IdentityContextProvider } from 'react-netlify-identity';

function App() {
  const url = 'https://your-identity-instance.netlify.com/'; // supply the url of your Netlify site instance. VERY IMPORTANT. no point putting in env var since this is public anyway
  return (
    <IdentityContextProvider url={url}>
      {/* rest of your app */}
    </IdentityContextProvider>
  );
}

Click for More Example code

import { useIdentityContext } from 'react-netlify-identity';

// log in/sign up example
function Login() {
  const { loginUser, signupUser } = useIdentityContext();
  const formRef = React.useRef();
  const [msg, setMsg] = React.useState('');

  const signup = () => {
    const email = formRef.current.email.value;
    const password = formRef.current.password.value;

    signupUser(email, password)
      .then(user => {
        console.log('Success! Signed up', user);
        navigate('/dashboard');
      })
      .catch(err => console.error(err) || setMsg('Error: ' + err.message));
  };

  return (
    <form
      ref={formRef}
      onSubmit={e => {
        e.preventDefault();
        const email = e.target.email.value;
        const password = e.target.password.value;
        load(loginUser(email, password, true))
          .then(user => {
            console.log('Success! Logged in', user);
            navigate('/dashboard');
          })
          .catch(err => console.error(err) || setMsg('Error: ' + err.message));
      }}
    >
      <div>
        <label>
          Email:
          <input type="email" name="email" />
        </label>
      </div>
      <div>
        <label>
          Password:
          <input type="password" name="password" />
        </label>
      </div>
      <div>
        <input type="submit" value="Log in" />
        <button onClick={signup}>Sign Up </button>
        {msg && <pre>{msg}</pre>}
      </div>
    </form>
  );
}

// log out user
function Logout() {
  const { logoutUser } = useIdentityContext();
  return <button onClick={logoutUser}>You are signed in. Log Out</button>;
}

// check `identity.user` in a protected route
function PrivateRoute(props) {
  const identity = useIdentityContext();
  let { as: Comp, ...rest } = props;
  return identity.user ? (
    <Comp {...rest} />
  ) : (
    <div>
      <h3>You are trying to view a protected page. Please log in</h3>
      <Login />
    </div>
  );
}

// check if user has confirmed their email
// use authedFetch API to make a request to Netlify Function with the user's JWT token,
// letting your function use the `user` object
function Dashboard() {
  const { isConfirmedUser, authedFetch } = useIdentityContext();
  const [msg, setMsg] = React.useState('Click to load something');
  const handler = () => {
    authedFetch.get('/.netlify/functions/authEndPoint').then(setMsg);
  };
  return (
    <div>
      <h3>This is a Protected Dashboard!</h3>
      {!isConfirmedUser && (
        <pre style={{ backgroundColor: 'papayawhip' }}>
          You have not confirmed your email. Please confirm it before you ping
          the API.
        </pre>
      )}
      <hr />
      <div>
        <p>You can try pinging our authenticated API here.</p>
        <p>
          If you are logged in, you should be able to see a `user` info here.
        </p>
        <button onClick={handler}>Ping authenticated API</button>
        <pre>{JSON.stringify(msg, null, 2)}</pre>
      </div>
    </div>
  );
}

How to handle a Recovery Action (since v0.2)

Of course you can alternatively inline this logic into app.

import { useIdentityContext } from 'react-netlify-identity';
import {
  BrowserRouter as Router,
  Switch,
  Route,
  useLocation,
  useHistory,
} from 'react-router-dom';

export default function App() {
  const { isLoggedIn } = useIdentityContext();

  return (
    <Router>
      <CatchNetlifyRecoveryNullComponent />
      <Switch>
        {isLoggedIn ? (
          <>
            <Route path="/dashboard" exact component={DashboardPage} />
            <Route component={() => <Redirect to="/dashbard" />} />
          </>
        ) : (
          <>
            <Route path="/" exact component={LandingPage} />
            <Route path="/register" exact component={RegisterPage} />
            <Route path="/login" exact component={LoginPage} />
            {/* etc */}
            <Route path="/recovery" exact component={RecoveryPage} />
            <Route component={() => <Redirect to="/" />} />
          </>
        )}
      </Switch>
    </Router>
  );
}

function CatchNetlifyRecoveryNullComponent() {
  const {
    param: { token, type },
  } = useIdentityContext();
  const { replace } = useHistory();
  const { pathname } = useLocation();

  // important to check for the current pathname here because else you land
  // in a infinite loop
  if (token && type === 'recovery' && pathname === '/') {
    replace(`/recovery`, { token });
  }

  return null;
}

function RecoveryPage() {
  const {
    location: { state },
  } = useHistory();
  // this state _might_ not be needed, it was needed in my specific implementation
  const [token] = useState(state?.token);

  return null; // set new password in a form and call updateUser
}

Lower level API: useNetlifyIdentity

If you'd like to handle your own context yourself, you can use this library as a hook as well:

function useNetlifyIdentity(
  url: string,
  onAuthChange: authChangeParam = () => {},
  enableRunRoutes: boolean = true
): ReactNetlifyIdentityAPI;

License

MIT ยฉ sw-yx

react-netlify-identity's People

Contributors

dependabot[bot] avatar levindixon avatar lewislbr avatar ljosberinn avatar mxmul avatar skn0tt avatar swyxio avatar wouterraateland avatar ychebotaev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-netlify-identity's Issues

/settings endpoint is pinged in a endless loop

Hi!

Your plugin is great! It worked very fine until now, but after upgrading to the latest version, I noticed in the chrome network tab that the /settings endpoint is pinged in a endless loop, which causes all components that are subscribed to the context to rerender on every ping.

Did you already notice this problem (and know an easy fix for this)?

You can see it an example on:

https://deploy-preview-5--ntrepreneur.netlify.com/

If you need any further code snippets, or have any questions, feel free to ask!

The user is undefined after a page refresh.

A page refresh logs a user out. This behaviour can be seen in the example linked in the README.

To reproduce:

Go to https://netlify-gotrue-in-react.netlify.com/

I can log in by providing by the url to my identity service: https://dropclub.netlify.com

After logging in I'm redirected to /dashboard. Then, when I refresh the page I am redirected back to the login page and I can see that user is undefined in the console.

I was under the impression that gotrue-js should be storing the user information in localStorage for me. Is this functionality outside of the scope of this package or would you expect it to work?

Authenticated API not returning a user after a period of inactivity

Hi, I'm new to this and I've started putting together an app that uses the react-netlify-identity bindings in order to achieve the level of flexibility I wanted for the authentication flow using Netlify Identity.

I've been experiences the following issue:
After a period of inactivity (I guess the one hour the token is valid), and given that remember was left to its default true, the user is shown as logged is however when checking the current context by pinging the authenticated API using for example the authedFetch method, no user object seems to exists. I can only see the identity object.

Am I missing any logic for handling such scenario?

I have the working app at this address https://toask.netlify.app/ - it's connected to FaunaDB using Apollo client for handling a list of plain todo list. This uses the context.user.sub to associate a list of todos to a user and as you can image, with the scanario mentioned above, no data is returned when no sub is found in the context.

If I log out the user from useIdentityContext(), the user object is correctly returned it would seem.

Anyone can suggest what I should look out for?

How to confirm email?

I invited user (myself) from netlify Identity console, and receive email titled "You've been invited to join ..." with "Accept the invite" link within it.

I follow this link and turned up at my-app.com/login page. When I enter my email and empty password I get error: invalid_grant: Email not confirmed

So i'm wondering how do I suppose to confirm email before using?

How to verify an invited user?

such as in the case that the url contains #invite_token=token.

I see this in the documentation:

  • verifyToken()
    • consumes & verifies TokenParam based on the type and tries to retrieve a valid user object
    • devs duty to show password field to afterwards call signupUser(user.email, newPassword)

but can't figure out how to implement this.

when I use

const { param: { token, type }, verifyToken } = useIdentityContext();

token and type are defined as they should be, but calling verifyToken() gives me this error:

Uncaught (in promise) JSONHTTPError: Verify requires a verification type

How to integrate with apollo client?

I have a simple graphql netlify function and I would like to integrate react-netlify-identity. Is there a built in method I can use? Or some other way around?

Using with Google Auth

On Netlify, I have the Google identity enabled and using the default config.
When I attempt to auth using loginProvider('google'), I can see the src does a redirect to the configured url ending in "/.netlify/identity/authorize?provider=google" The issue is it shows my app and not the Google auth screen. Any ideas what I'm missing?

I'm using a CRA and it looks like it's an issue when using the ServiceWorker. If I go into chrome and disable the ServiceWorker, I get to the Google Auth screen.

localStorage is not defined when building Gatsby project

When building an optimized production build of my gatsby app, i get an error saying "WebpackError: ReferenceError: localStorage is not defined".

Could be because of gotrue, but the error is happening when calling the hook. Is there a way to conditionally load it?

Great module btw! :)

security: NPM audit fails due to outdated dependency

Current Behavior

currently used version of dependency tsdx fails the npm security audit:

 "tsdx": "^0.12.3",

https://github.com/sw-yx/react-netlify-identity/blob/master/package.json#L56

โ”‚ moderate โ”‚ Cross-Site Scripting โ”‚
โ”‚ Package โ”‚ serialize-javascript โ”‚
โ”‚ Patched in โ”‚ >=2.1.1

Expected behavior

no npm audit failure

Suggested solution(s)

upgrade to latest version of tsdx

Additional context

This prevents this library to be used in any security aware projects

recoverAccount workflow

Hi, so I've been tinkering with a reset-password route for a while and found this issue:

  • request a password recovery via requestPasswordRecovery(mail) -> netlify sends out reset mail
  • runRoutes triggers and... well, does nothing - which I guess is fine, just a heads up in the docs would've been nice
  • so I circumvented this by catching the recovery token myself and rerouting it to my route
  • there, recoverAccount(token) fetches a User object based on the verified token but performs no login, valid too
  • while this happens, the user can enter his new password and then submit
  • I'm now in possession of a regular User object, together with a valid JWT through the token and the new password - I should now be able to update the password via updateUser({ password }) - but because recoverAccount(token) didn't change any lib internal state, it throws the are you logged in error.
  • so I manually feed the token-verification User obj to the lib because after the state change, user is no longer null
  • it finally executes user!.update(fields).then(_setUser) in another effect where I have to ignore errors thrown from the lib - not sure why these are triggered

It's finally working but imo that's a mess. Am I doing something massively wrong here?

Cookie storage after following confirmation link

Hi @sw-yx ๐Ÿ‘‹

After a user signs up they receive a link to verify their email, when they click that link they're redirected to the application but it looks like the gotrue.user isn't stored.

Not sure if this is expected behavior or a bug, is the user expected to login again after following the email verification link?

Thanks!

'./dist/react-netlify-identity.es.production.js' does not exist, did you mean './dist/react-netlify-identity.cjs.production.min.js'?'

I am using Windows 10 OS, running a project using parcel@latest and yarn init -2 and deploying the project to Netlify. My challenge is that I cannot use react-netlify-identity library for Identity strategy. The code crashes with the above stated error.

Code

package.js

{
  "name": "kubuka-sub",
  "packageManager": "[email protected]",
  "private": true,
  "source": "public/index.html",
  "scripts": {
    "start": "parcel --https --open --port 7420",
    "build": "parcel build"
  },
  "devDependencies": {
    "@parcel/compressor-brotli": "^2.5.0",
    "@parcel/compressor-gzip": "^2.5.0",
    "@parcel/config-default": "^2.5.0",
    "@parcel/core": "^2.5.0",
    "@parcel/resolver-default": "^2.5.0",
    "@parcel/transformer-raw": "^2.5.0",
    "@parcel/transformer-svg-react": "^2.5.0",
    "@tailwindcss/aspect-ratio": "^0.4.0",
    "@tailwindcss/forms": "^0.5.2",
    "@tailwindcss/line-clamp": "^0.4.0",
    "parcel": "^2.5.0",
    "postcss": "^8.4.14",
    "tailwindcss": "^3.0.24"
  },
  "dependencies": {
    "@emotion/css": "^11.9.0",
    "@emotion/react": "^11.9.0",
    "@fortawesome/fontawesome-free": "^6.1.1",
    "@headlessui/react": "^1.6.2",
    "@heroicons/react": "^1.0.6",
    "faunadb": "^4.5.4",
    "formik": "^2.2.9",
    "gotrue-js": "^0.9.29",
    "is-hotkey": "^0.2.0",
    "process": "^0.11.10",
    "react": "17",
    "react-dom": "17",
    "react-netlify-identity": "^0.2.5",
    "react-router-dom": "^6.3.0",
    "rxjs": "^7.5.5",
    "slate": "^0.78.0",
    "slate-history": "^0.66.0",
    "slate-react": "^0.79.0",
    "web-vitals": "^2.1.4",
    "yup": "^0.32.11"
  },
  "alias": {
    "process": {
      "global": "process"
    }
  },
  "browserslist": "> 0.5%, not op_mini all, not ie 11, not ios_saf < 13"
}

index.html

<!DOCTYPE html>
<html lang="en" class="h-full bg-gray-50">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon">
  <title>Kubuka Space PBC - Scouting the hidden genius</title>
</head>
<body class="h-full">
  <div id="root"></div>
  <script type="module" src="../src/index.js"></script>
</body>
</html>

tailwind.config.js

module.exports = {
  content: [
    "./src/**/*.{html,js,ts,jsx,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [
    require('@tailwindcss/forms'),
    require('@tailwindcss/aspect-ratio'),
    require('@tailwindcss/line-clamp'),
  ],
}

.postcssrc

{
  "plugins": {
    "tailwindcss": {}
  },
  "extends": "@parcel/config-default",
  "resolvers": ["@company/parcel-resolver", "..."]
}

.parcelrc

{
  "extends": "@parcel/config-default",
  "transformers": {
    "*.svg": ["...", "@parcel/transformer-svg-react"],
    "*.{zip,tgz,mp4,png,jpeg,jpg,mp3}": ["@parcel/transformer-raw"]
  }
}

ContextProvider.js

import { useEffect, useState, createContext, useContext } from 'react';
import { useParams } from 'react-router-dom';
import { useNetlifyIdentity } from "react-netlify-identity";


const ApiContext = createContext();

export const ContextProvider = ({ children }) => {
  const [url] = useState("https://www.mysitelinkmain.com");
  const identity = useNetlifyIdentity(url);

  return (
    <ApiContext.Provider value={identity}>
    {children}
    </ApiContext.Provider>
  );
};

export const useCtx = () => {
  return useContext(ApiContext);
};

How it is behaving

  1. yarn init -2 - Successful
  2. yarn install - Successful
  3. yarn start - xBuild failed =>
ร— Build failed.

@parcel/core: Failed to resolve 'react-netlify-identity' from './src/.../context/index.js'

  C:\Users\...\src\components\context\index.js:3:36
    2 | import { useParams } from 'react-router-dom';
  > 3 | import { useNetlifyIdentity } from "react-netlify-identity";
  >   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^

@parcel/resolver-default: Could not load './dist/react-netlify-identity.es.production.js' from module
'react-netlify-identity' found in package.json#module

  C:\Users\...\.yarn\__virtual__\react-netlify-identity-virtual-92217ec8e4\0\cache\react-netlify-identity-npm-0.2.5-e3363cde5b-8b31bb74f9.zip\node_modules\react-netlify-identity\package.json:10:13
     9 |   "umd:main": "dist/react-netlify-identity.umd.production.js",
  > 10 |   "module": "dist/react-netlify-identity.es.production.js",
  >    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ './dist/react-netlify-identity.es.production.js' does not exist, did you mean './dist/react-netlify-identity.cjs.production.min.js'?'
    11 |   "typings": "dist/index.d.ts",
    12 |   "jsnext:main": "dist/index.es.js",

I hope this is not too long. It's my first time to post an error so I don't know the standard way of doing it or whether there are templates used.

Thank you

Usage when developing locally?

Currently, logging in automatically redirects me to the live netlify site and logs me in there as the redirect is that domain too, naturally. But obviously I'd like to be logged in on localhost.

A localhost URL is invalid, however, which makes sense since locally there's no identity lambda.

Right now I'm copying localstorage from live over to localhost which is annoying and probably not intended.

Do I miss something obvious or is this simply not supported right now?

Sidenote: running with netlify dev in case that changes anything.

Issues with recoverAccount

When trying to implement recoverAccount(), I keep getting the "user not found" error. I did not see many docs on this. The error:

code: 404
msg: "User not found"
  • I am able to send the reset password email successfully
  • I am able to get the token from useIdentityContext() and show my <RecoverAccountModal /> successfully
  • Then I call recoverAccount() with the updated password and get a successful user response, which I use to set updated user inside setUser(recoveredUser)

However, it fails when I call updateUser(). When I console.log the user from useIdentityContext() it is undefined, so I know that setUser() is not working properly for me, perhaps not finishing before updateUser() is called. But, it is not a promise, so await will not help. Any assistance would be hugely appreciated. Here is my code:

RecoverAccountModal.tsx

        // ensure passwords match and not empty
         if (password !== '' && password === confirmPassword) {
              // recover account using token from reset password email
              await recoverAccount(true)
                .then(async user => {
                  // log in the current user so we can call updateUser
                  setUser(user);
                  await updateUser({ password })
                    .then(updatedUser => {
                      setMessage('Password updated successfully!');
                    })
                    .catch(error => {
                      console.log('Failed to update user:', error);
                      setMessage(
                        'Password cannot be updated. Please try getting a new recovery link.'
                      );
                    });
                })
                .catch(err => {
                  console.log('Error running recoverAccount()', err);
                });
            } else {
              setMessage('Passwords do not match.');
            }

You Removed core files

Tried to update to v2.0.6

Now I am getting the below error not only on v2.0.6 but all lower versions to.

Can't resolve './react-netlify-identity-widget.cjs.production.min.js' in 'C:\Users\Donald Boulton\Documents\GitHub\publiuslogic\publiuslogic\node_modules\react-netlify-identity-widget\dist'

File: node_modules\react-netlify-identity-widget\dist\index.js

They do not exist and removed from all packages I tried???

Why would you do this?

Spent a lot of time integrating this and now its not usable = and done intentionally

Authenticated API returns no user although being logged in

Hi, I'm new to this and I've started putting together an app that uses the react-netlify-identity bindings in order to achieve the level of flexibility I wanted for the authentication flow using Netlify Identity.

I've been experiences the following issue:
After a period of inactivity (I guess the one hour the token is valid), and given that remember was left to its default true, the user is shown as logged is however when checking the current context by pinging the authenticated API using for example the authedFetch method, no user object seems to exists. I can only see the identity object.

Am I missing any logic for handling such scenario?

I have the working app at this address https://jotty.netlify.app/ - it's connected to FaunaDB using Apollo client for handling a list of plain todo list. This uses the context.user.sub to associate a list of todos to a user and as you can image, with the scanario mentioned above, no data is returned when no sub is found in the context.

If I log out the user from useIdentityContext(), the user object is correctly returned it would seem.

Anyone can suggest what I should look out for?

SEEKING MAINTAINERS

SEEKING MAINTAINERS

i've left Netlify. obviously i still care about netlify but im gonna have other stuff to do and wont be able to give this my full attention. pls open an issue if you use this and want to take over. post your npm username too. i'd love to find a good home for this project.

Getting OAuthID and Email Verified flags

I am using react-netlify-identity with google provider to authenticate users. Getting the user data like - avatar_url, name etc. But I am not able to retrieve the emailVerified and oauthId fields from netlify redirect response. Only getting some uuid in the id field of the user. Is there a way to configure this or is this intended?

Issues confirming emails

As far as I understand it the hook handles email confirmation by default and it appears to be trying to but failing.

From what I can tell runRoutes correctly identifies the confirmation route and calls gotrue.confirm but somewhere within that call an error occurs.

The error logged is Error in confirm call JSONHTTPError: Failed to handle signup webhook.

Forgot password? Button not working?

Unsing "react-netlify-identity-widget": "^0.2.4" with gatsby-plugin-netlify-identityit looks like the "Forgot password" button on the IdentityModal is not working.

And second issue is when I "send reset password mail" from within netlify, the mail is received, but the contained link just leads to the hompepage instead of any site where the password could be reset.

Could these two issues be fixed? I do very much appreciate the convenience this plugin offers.

How to implement recover account?

In my Recover page, I have a function component that takes the user password. This is given that the token is catched from runRoutes. I basically followed the implementation recovery action guide from here.

The thing that I can't figure out is whether recoverAccount and updateUser is the way to go? Problem is updateUser fails.

recoverAccount(true)
      .then((userFromToken) => {
        console.log("userFromToken", userFromToken);
        
        // --> This doesn't work. It says, user is not logged in.
        updateUser({ password })
          .then((updatedUser) => {
            setFormState("user_updated");
            console.log("Updated user %s", updatedUser);
          })
          .catch((error) => {
            console.log("Failed to update user: %o", error);
          });
      })
      .catch((error) => {
        console.log(error);
      });

Alternatively, I used verifyToken and setUser which is not recommended. The same updateUser function call doesn't seem to work.

isLoggedIn always false

After successfully confirm email with approach described here, I'm trying to log in.

Then, when I enter email and password and invoke loginUser with them, I expect to isLoggedIn to be true.

But isLoggedIn flag always returns false for me.

How I can overcome this obstacle?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.