NextAuth credentials how to handle unauthorized user?
I have this parent component which distinguishes if the user is logged in or not and redirect the user in the specific case.
I signed in to my app and deleted all my storage and cookie data which would result me being unauthorized.
But the redirect / condition does not work properly in this component:
console.log('status', status)
keeps returning loading why? How can I properly handle this?9 Replies
I mean I could check every page with a useSession hook, but that is a lot of repition
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
@beanzii hmm but would that work with the credentials option?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah I tried to use the middleware route opto
option*, but that did nt
not work out for me, you got a snippet of how you use it?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I am using jwt, let me try again
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I also do what beanzil does as well. in gSSP i use getServerAuthSession and i redirect: