R
Refine

ask-any-question

AuthPage not redirecting to forgot-password page

Aambitious-aqua2/7/2023
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
Aadverse-sapphire2/7/2023
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.
Aambitious-aqua2/7/2023
Got it, thank you very much ๐ŸคŸ
Aadverse-sapphire2/7/2023
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. ๐Ÿ™
Wwee-brown2/8/2023
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. ๐Ÿ˜„๐Ÿ‘

Looking for more? Join the community!

R
Refine

ask-any-question

Join Server