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](https://cdn.answeroverflow.com/1072461900555755561/Screenshot_2566-02-07_at_17.14.47.png)
![No description](https://cdn.answeroverflow.com/1072461900903874580/Screenshot_2566-02-07_at_17.17.58.png)
![No description](https://cdn.answeroverflow.com/1072461901247819776/Screenshot_2566-02-07_at_17.19.42.png)
4 Replies
afraid-scarletโข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.foreign-sapphireโข2y ago
Got it, thank you very much ๐ค
afraid-scarletโข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. ๐
stormy-goldโข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. ๐๐