Next.js Discord

Discord Forum

NextAuth.js: signIn Pages: Showing a component not a whole page

Unanswered
English Shepherd posted this in #help-forum
Open in Discord
English ShepherdOP
I want to show a component that drops down using search Params like "?form=login" not a whole page when redirected. And what I am doing is {pages: {signIn: "?form=login"} but it keeps changing the "?form=login" to "%3Fform=login" and causes the login component to not show up. Because the login component is designed to be displayed when there is a param like "?form=login". What can I do to make it work?

12 Replies

Sun bear
my suggestion is to always use nuqs when building something with search params
makes it much easier to deal with and almost like useState
@Sun bear https://nuqs.dev/
English ShepherdOP
But the problem is not about search params though.
Long-horned bees
One moment
I think that would be the perfect use case for route interceptors
in a nutshell, if a person goes to /auth/sign-in or smth and you intercept the route you can show a dialog with your component
if that's navigated to directly by refreshing or sending the link to someone and them clicking on it then it shows the actual page you have for /auth/sign-in
Ill send you the docs in a min
@Long-horned bees One moment
English ShepherdOP
Thank you so much.
Long-horned bees
Pleasure