danurbanowicz / eleventy-netlify-boilerplate

A template for building a blog with the Eleventy static site generator and Decap CMS
https://eleventy-netlify-boilerplate.netlify.app/
MIT License
528 stars 183 forks source link

Auto-redirect doesn't work #37

Closed PierW closed 4 years ago

PierW commented 4 years ago

On production (netlify) there is a problem with the redirect after the login in admin area. I tried to insert this in homepage... it's works fine but just on local: <script> if (window.netlifyIdentity) { window.netlifyIdentity.on("init", user => { if (!user) { window.netlifyIdentity.on("login", () => { document.location.href = "/admin/"; }); } }); } </script>

in production I still have to press the button: "Login with Netlify Identity"

danurbanowicz commented 4 years ago

Hi, this is indeed annoying and I think it may be related to an issue with gotrue-js not updating the user token on first load.

https://github.com/netlify/gotrue-js/issues/71

Add to that the various UX concerns with the Netlify Identity Widget, I'm not sure what we can do to fix it right now.

Correct me if I'm misunderstanding your issue.