like-gold
like-goldโ€ข2y ago

AuthPage not redirecting to forgot-password page

Right now I'm using strapi auth provider with nextjs. After pressing the forgot password page it got stuck in the login page. I have already follow the forgot password setup in refine doc. Not sure if I'm missing something. The login flow work fine.
No description
No description
No description
4 Replies
xenial-black
xenial-blackโ€ข2y ago
Hey @phumcentral sorry for the issue! Looks like there's lack of info about this part in our docs. In Next.js, custom route creation is not done like this; https://refine.dev/docs/advanced-tutorials/ssr/nextjs/#custom-page here's the docs for it. You need to create a page in /pages (just like regular Next.js apps) So, having a page pages/forgot-password.tsx with rendering <AuthPage type="forgot-password" /> should do the trick. About the issue you're seeing, with [[...refine]].tsx route, we're running checkAuth of authProvider to redirect users to /login if they're unauthenticated. And since you don't actually have a /forgot-password route, [[...refine]] route is matched as a fallback (by next.js) and it checks for auth and tries to redirect to /login again. Creating a custom page at pages dir, lets you skip the checkAuth process and render the page without a redirect.
like-gold
like-goldโ€ข2y ago
Got it, thank you very much ๐ŸคŸ
xenial-black
xenial-blackโ€ข2y ago
Added tasks about this to our backlog, one for updating the docs with proper instructions for Next.js and Remix. Other is to create an example with nextjs and auth pages. ๐Ÿ™
xenial-black
xenial-blackโ€ข2y ago
I tried this way, but it's not working with the i18n. So I just create customNextRouteComponent. It's looks work well, but I think it's not a good code. So I recommend to use this method only as a temporary. More specific information, check this commit in below link. https://github.com/JinYeJin/gateway/commit/1274f1520af29af5293863438e3f2f94e5d19092 I hope update the docs soon. ๐Ÿ˜„๐Ÿ‘