Edit default sign in form
Hello, I just want to know how to edit this form:
21 Replies
You cant really edit the default one (theres some theming option but its limited), but you can make a custom one https://next-auth.js.org/configuration/pages
Pages | NextAuth.js
NextAuth.js automatically creates simple, unbranded authentication pages for handling Sign in, Sign out, Email Verification and displaying error messages.
oh okay
so it dont depend from t3
No - were not doing anything custom there
ok thanks, and an another question
how do you make that the user is redirected when he's not logged in ?
I did that but it always redirect me
You should use getServerSession there
why ? (for understand and not do the same mistake)
(then I get that:
getServerSession
is used in a React Server Component.)a) it is the one thet they have ported to appRouter
b) getSession is a client side hook that triggers unnecesdary fetches if fired from server
I think I need to understand better how to use it
because I put "use client"
at the top
Oh - my bad. But you shouldnt have use client on layouts
Just remove the use client here
Yeah but a got an error with the session provider
Create a wrapper for it (that’s use client) and use that
Okay, I need to check how to do it so
you'll need to do that for quite a few lib that hasn't yet put the directive in their code
but with time libs will do that for you
https://github.com/juliusmarminge/jumr.dev/blob/main/app/use-client.tsx
i have a file like that that exports stuff like that wrapped with use client
oh okay
hummm
Idk if it has a link
from this modification
on login
I broke something with my session provider
Every session is null now
I did something bad ?
Solution
This error is cause you’re missing a NEXTAuTH_SECRET
Everything work when I use the ""real"" sessionprovider
only when I want to access to getServerSession
The key has to be put in quotation marks
thanks
but same error btw
next time
i'll rtd
okay so I dont have this error anymore
but my session provider still "doesn't work"; it was like I have no session in other pages
Thank for all guys,
everething is working now