Installation of Identity

Website = epghoa.org

On your DOC Pages @ Authenticate users with Netlify Identity | Netlify Docs it has the statement "To use the service in your site, you CAN add the Netlify Identity widget to your repository.

Like so many articles and tutorials it says WHAT TO DO but it does NOT say HOW OR WHERE TO DO IT.

I finally found the WHERE in another doc where it said it should be in your LANDING PAGE.

After reading most of your docs I still could NOT find anything on the HOW.

Can you point me to where I can find the HOW because the site I am building is to be available to only the residents of our subdivision and I want to use the password log-in for the residents access to the site.

Thank you

Gerald Brown

If you look at the @netlify/netlify-identity-widget repository it gives an example of how to use it

<!DOCTYPE html>
<html>
<head>
  <title>A static website</title>

  <!-- include the widget -->
  <script type="text/javascript" src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
</head>
<body>
  <!-- Add a menu:
   Log in / Sign up - when the user is not logged in
   Username / Log out - when the user is logged in
  -->
  <div data-netlify-identity-menu></div>

  <!-- Add a simpler button:
    Simple button that will open the modal.
  -->
  <div data-netlify-identity-button>Login with Netlify Identity</div>
</body>
</html>

What should the name of the HTML file be and where should it be located?

That would depend on what part or parts of the site you want to protect. Any path of a site that you want to protect requires the widget code in it.

I want to protect the WHOLE site, not just parts of it. Does this mean I need the widget on ALL pages?

Yes you will.

You might also want to look to Redirect visitors based on roles so that non-logged in users are shown the login page.

Does that mean the users will have to log in to every page?

I also thought that each user would create their own user name and password. Is this NOT true?

No. But Netlify Identity will make sure they are logged.

Yes, they can do that.

OK. Correct me if I am wrong. I put the widget on the HOME page, the user signs in & creates a user name & password, the next time they just log in by entering their password.

If they are logged in at the home page do I still need the widget on all pages?

I finally got it to work. Thanks for your help.

Glad you got it working! (:

I got the login working but after I log in NOTHING happens. How do I get it to continue to the site? Plus how do I log out again as the form has disappeared.

There’s nothing blocking from you continuing with the site. The repository shared by @jasiqli above has all the required information. You need to listen for the login event to do something after a user has logged in.