-
I want to store generated files into database so that I can auth which user can visit pages,but I find that some js files' name are generated differently each time I run build cmd. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Not clear to me what you are really trying to achieve here. Docusaurus is Jamstack so it output static HTML and js files. The JS file names should not matter and you should not rely on them to protect your site. If you need to have an auth section on your site, you can instead create pages that are "browser only", and will only display data after your API has validated that the user is authenticated. https://v2.docusaurus.io/docs/docusaurus-core#browseronly export default AuthenticatedPage() {
return (
<BrowserOnly fallback={<Spinner/>}>
{() => (
<AuthenticatedContent/>
)}
</BrowserOnly>
);
} AuthenticatedContent is a component you have to build that will call your API, check for auth, return appropriate sensitive/user-specific data to render on the page, and then render that data on the client. |
Beta Was this translation helpful? Give feedback.
Not clear to me what you are really trying to achieve here.
Docusaurus is Jamstack so it output static HTML and js files. The JS file names should not matter and you should not rely on them to protect your site.
If you need to have an auth section on your site, you can instead create pages that are "browser only", and will only display data after your API has validated that the user is authenticated.
https://v2.docusaurus.io/docs/docusaurus-core#browseronly
AuthenticatedContent is a component you have to build that will call…