1

I have a static website generated by Docusaurus and I added firebase authentication it works fine but the path to my markdown files still not secured (everyone can access it without authentication). Is it possible to add this code to markdown files ?

..
const [user, loading, error] = useAuthState(auth);
  const navigate = useHistory();

  useEffect(() => {
    if (loading) return;
    if (!user) return navigate.push("/");
  }, [user, loading]);
..

Please any help to make this possible

hakima maarouf
  • 1,010
  • 1
  • 9
  • 26
  • 1
    While there is no single way but one of the guy who works on docusaurus and is a contractor for facebook pointed out how to do it here: https://github.com/facebook/docusaurus/issues/958#issuecomment-1057075925 – Harry Mar 10 '22 at 14:21
  • @Harry Thank you, the last solution seems good, but I didn't understand the steps to do it! – hakima maarouf Mar 10 '22 at 14:26
  • Sorry but I haven't dig into those details yet. I am planning to create a docusaurus site for myself like a digital garden with a private route for my private writings hence your requirement is the same like mine. Feel free to comment there. – Harry Mar 10 '22 at 15:38
  • @Harry okey and if I find something useful i'll share it here .. best of luck! – hakima maarouf Mar 10 '22 at 16:01
  • Just an update: I filed an issue at github docusaurus and surprisingly the maintainers have accepted it and opened pull requests for deployment into docusaurus core code :) – Harry Mar 13 '22 at 00:53

0 Answers0