Home
Support Forums

Identity integration with a static web site

Hello,

We are evaluating netlify as a solution to host a private documentation web site (built with hugo), with the following requirements:

  • The whole site is authenticated, no need for public/private parts, access control by role, etc.
  • Invite only
  • should be able to use external service to manage the authentication (google, github, etc.)

Netlify Identity seems like the perfect fit. However, However, it looks likewe need to do some coding to integrate our pure static web site with Netlify identity, like turning it into a React app just to do the authentication part. I did not see in the admin interface, in the access control section, a way to just to authenticate the whole web site with Netlify Identity.
Did I miss something, or do we really have to start coding :wink: ?

Thank you in advance.

Nope, not a lot of coding needed. Just grab the Netlify Identity Widget from the CDN, add it to your website → Enable Identity in the Site Settings and configure it as you see fit → Add Role Based Access Control as explained in the docs.

However, I’m confused by this:

No need for access control by role? If you don’t want to set access based on roles, well Netlify Identity is not an option for you.

Thank you for your answer, I made a lot of progress thanks to your last remark: yes indeed I need at least one role for Netlify Identity to work. The authentification with Identity works now on my web site. I have one issue I have not been able to fix: Is there a way, after the user is successfully authenticated with the widget, to prevent this modal window below to be displayed ? I would like to display directly the page…

Thank you in Advance, Fred

I haven’t tested it, but I believe you could do something like:

netlifyIdentity.on('login', user => {
  netlifyIdentity.close()
})