Hacker News new | past | comments | ask | show | jobs | submit login

can I add authentication on top of it to restrict docs access to logged-in users?



You can restrict docs access by using Http basic auth at the host level (CDNs like Vercel/Netlify/Cloudflare usually provide this feature).

If you want in-app authentication, remember we are a static site generator so at the end of the day we have to produce static html files, and at build time we can't know which user it is. You can use a client-side authentication where your HTML first render a profile placeholder and then the profile data gets loaded with an auth request. You can also render a full-screen spinner on the static page, and then use React client-side to auth the user.

See also: https://github.com/facebook/docusaurus/issues/958#issuecomme...


If you’re using Vercel, here’s an example: https://github.com/vercel/examples/tree/main/edge-functions/...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: