To Server Auth or Client
Unanswered
American Wirehair posted this in #help-forum
American WirehairOP
I’m working on an app and am currently using server side auth.
I’ve got it working and using redirect routes I’ve sorted how to provide a login form wherever I’d like and then manage the redirect back to the users original state.
But, wow is that tedious.
I’m wondering if I’m not better off just sticking to client side authentication.
Has anyone faced this fun space.
What did you do?
I’ve got it working and using redirect routes I’ve sorted how to provide a login form wherever I’d like and then manage the redirect back to the users original state.
But, wow is that tedious.
I’m wondering if I’m not better off just sticking to client side authentication.
Has anyone faced this fun space.
What did you do?
4 Replies
Sun bear
I am handling auth via middleware.
/admin only available for user role admin and dev
/dev only for dev
rest for whitelisted users
else redirect to /login or /no-access
For me thats working good. But I dont have a super complicated user role management. So its easy to check it
/admin only available for user role admin and dev
/dev only for dev
rest for whitelisted users
else redirect to /login or /no-access
For me thats working good. But I dont have a super complicated user role management. So its easy to check it
American WirehairOP
@Sun bear that’s what I have now but I don’t love the workflow for users to auth in place as I’m give features that let a user get further down the funnel before needing to create an account
@American Wirehair <@908094633660268555> that’s what I have now but I don’t love the workflow for users to auth in place as I’m give features that let a user get further down the funnel before needing to create an account
Sun bear
But you can also define routes allowed for not authenticated users via middleware
American WirehairOP
Yes, but I’m saying that Next.js serverside auth, robs one of the best values of client side auth.
I don’t want to give up the perks to capture benefits.
I want to have both.
It seems like to do that I just have to write a bespoke api route or something.
I don’t want to give up the perks to capture benefits.
I want to have both.
It seems like to do that I just have to write a bespoke api route or something.